sql用case when查询group

select transcode,sum(case when wssatus = '0000' then 1 else 0 end),sum(case when wssatus = '0000' and retnum > 0 then 1 else 0 end) from code_table where begintime > '2018-08-08' group by transcode.

猜你喜欢

转载自blog.csdn.net/John_Kry/article/details/90229870