MYSQL 巧用count,sum進行統計數據

SELECT a.user,count(b.order_id) as subcount,sum(if(b.verifysta='Y',1,0)) as passcount FROM vicidial_users a LEFT JOIN vicidial_order b on a.user = b.user WHERE a.user_group = 'TeamOne' GROUP BY a.user
相關文章
相關標籤/搜索