sql 某列当中相同的类型累加
select Sum(case when buy_status =1 then 1 else 0 end) '订购', Sum(case when buy_status =2 then 1 else 0 end) '退订',Sum(case when buy_status =6 then 1 else 0 end) '续订'from business_recordGROUP BY DATE(create_time)

发布时间: 2013-03-25 15:43:04 作者: rapoo
sql 某列当中相同的类型累加
select Sum(case when buy_status =1 then 1 else 0 end) '订购', Sum(case when buy_status =2 then 1 else 0 end) '退订',Sum(case when buy_status =6 then 1 else 0 end) '续订'from business_recordGROUP BY DATE(create_time)