题解 | SQLW24 查询单日多次下订单的用户信息?
WITH t1 AS ( SELECT DATE (order_time) AS order_date, user_id, COUNT(user_id) AS order_nums FROM order_tb GROUP BY DATE(order_time),user_id HAVING order_nums > 1 ) SELECT t1.*, a.vip FROM t1 LEFT JOIN uservip_tb a ON t1.user_id = a.user_id ORDER BY order_nums DESC; # 这道题别忘了进行结果的降序排序。