17,377
社区成员
发帖
与我相关
我的任务
分享
select max(a),max(b),max(c),max(g),count(1)
from test
group by case g when 0 then a when 1 then b when 2 then a when 3 then c end,
case g when 2 then b end;
select sum(case G when '1' then colUSD when '2' then colCNY end) 应收数
from tablename
group by case G when '1' then colA when '2' then colB end