Home  >  Article  >  Database  >  oracle数据库下统计专营店的男女数量的语句

oracle数据库下统计专营店的男女数量的语句

WBOY
WBOYOriginal
2016-06-07 18:07:18889browse

oracle数据库下统计专营店的男女数量的语句,方便需要的朋友

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
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn