sql分组统计查询 count带条件
- SELECT user_id,count(type=1 or null) donate_num,count(type=2 or null) rent_num
- FROM ot_dynamic
- GROUP BY user_id
版权声明:本文为deepalley原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
- SELECT user_id,count(type=1 or null) donate_num,count(type=2 or null) rent_num
- FROM ot_dynamic
- GROUP BY user_id