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

  

posted @ 2020-04-13 16:29  八英里  阅读(5197)  评论(0编辑  收藏  举报