sql 某列当中相同的类型累加

来源:互联网 发布:超星尔雅网络课程平台 编辑:程序博客网 时间:2024/06/05 02:44
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)


  • 大小: 2.1 KB
  • 查看图片附件