Web_THBC 為表示層也就是頁面(.aspx)
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