Leetcode Mysql 1565. 按月统计订单数与顾客数(DAY 10)

文章目录


原题题目


Leetcode Mysql 1565. 按月统计订单数与顾客数(DAY 10)


代码实现(首刷自解)


# Write your MySQL query statement below
SELECT month,order_count,customer_count
FROM  (SELECT DATE_FORMAT(order_date,"%Y-%m") AS month,COUNT(DISTINCT order_id) AS order_count,COUNT(DISTINCT customer_id) AS customer_count
       FROM orders
       WHERE invoice > 20
       GROUP BY DATE_FORMAT(order_date,"%Y-%m")) t
上一篇:【无标题】【思特奇杯·云上蓝桥-算法集训营】第1周


下一篇:时间(下)