sql语句,对刚查询的两个列值 进行计算

[复制链接]
查看11 | 回复2 | 2013-4-24 11:41:53 | 显示全部楼层 |阅读模式
这个貌似没有办法吧,你只有把a/b换成上面的公式SUM(case when name=a then FEE else 0 end)/ SUM(case when name=a then RC else 0 end)...
回复

使用道具 举报

千问 | 2013-4-24 11:41:53 | 显示全部楼层
做成一个CTE或者子查询。select a, b,case when HOS_CANTON=CANTON_CODE_XZ then a/b else 0 end as cfrom(select SUM(case when name=a then FEE else 0 end) as a,SUM(case when name=a t...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行