数据库
首页 > 数据库> > 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

标签:count,10,原题,订单数,order,customer,DATE,month,DAY
来源: https://blog.csdn.net/qq_37500516/article/details/120684853