sql中一个字段在多个条件下查询并且生成多列

日期:2019-07-17 09:20:13 人气:1

sql中一个字段在多个条件下查询并且生成多列

with t1 as ( --去重后的distrib select distinct(distrib) distrib from table1 where DATEPART(M,date)>=1 and DATEPART(M,date)<=6 ),t2 as ( --1-3月数据 select distrib,COUNT(mbr) as a from table1 where DATEPART(M,date)>=1 and DATEPART(M,date)<=3 g
    A+
热门评论