BLL_THBC 为业务逻辑层
DAL_THBC 为数据库交互层 (向数据库执行SQL语句)
Model_THBC 为实体类
DbHelper 为数据库连接类
统计个专营店的男女数量
相关操作代码如下:
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