时间:2021-07-01 10:21:17 帮助过:10人阅读
oracle数据库下统计专营店的男女数量的语句,方便需要的朋友
Web_THBC 为表示层也就是页面(.aspx)
select dua.UARTERS_ID,dua.UARTERS_NAME
,sum(case when sex = '1' then 1 else 0 end) as Man
,sum(case when sex = '0' then 1 else 0 end) as Woman
from dbo.DCAD_USER as du
left join
dbo.DCAD_UARTERS as dua
on du.UARTERS_ID = dua.UARTERS_ID
group by dua.UARTERS_ID,dua.UARTERS_NAME
作者 ershouyage