asfsd 发表于 2018-10-24 07:50:11

SQL的汇总统计SELECT语句

  select Site,sum(case when type='item01' then 1 else 0 end) as item01, sum(case when type=item02' then 1 else 0 end) as item02, sum(case when type='item03' then 1 else 0 end) as item03,count(*) as SubTotal from Tablegroup by site
  说明:
  用于汇总统计各个SITE的ITEM01/02/03的数量

页: [1]
查看完整版本: SQL的汇总统计SELECT语句