oracle數(shù)據(jù)庫下統(tǒng)計(jì)專營店的男女?dāng)?shù)量的語句

oracle數(shù)據(jù)庫下統(tǒng)計(jì)專營店的男女?dāng)?shù)量的語句,方便需要的朋友

Web_THBC 為表示層也就是頁面(.aspx)
BLL_THBC 為業(yè)務(wù)邏輯層
DAL_THBC 為數(shù)據(jù)庫交互層 (向數(shù)據(jù)庫執(zhí)行SQL語句)
Model_THBC 為實(shí)體類
DbHelper 為數(shù)據(jù)庫連接類

統(tǒng)計(jì)個(gè)專營店的男女?dāng)?shù)量
代碼如下:
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

? 版權(quán)聲明
THE END
喜歡就支持一下吧
點(diǎn)贊5 分享