题解 | 统计商家不同会员每日访问人次及访问人数
SELECT ut.vip, COUNT(vt.user_id) visit_nums, COUNT(DISTINCT vt.user_id) visit_users FROM visit_tb vt JOIN uservip_tb ut ON vt.user_id = ut.user_id GROUP BY ut.vip ORDER BY visit_nums DESC
SELECT ut.vip, COUNT(vt.user_id) visit_nums, COUNT(DISTINCT vt.user_id) visit_users FROM visit_tb vt JOIN uservip_tb ut ON vt.user_id = ut.user_id GROUP BY ut.vip ORDER BY visit_nums DESC
相关推荐