SQL query for Calculating Total No. of Orders per Day?

前端 未结 5 1472
自闭症患者
自闭症患者 2021-01-13 01:13

Can anyone post a SQL query for Calculating Total No. of Orders per Day?

Here are the Columns along with their data in my Database.


order_id            


        
5条回答
  •  有刺的猬
    2021-01-13 01:25

    A group by is your friend here. It can aggregate on grouped rows. An example query would be:

    SELECT order_placed_date, SUM(order_total)
      FROM orders
     GROUP BY order_placed_date
    

    Of course, in your example you'd probably want to extract just the day/month/year part using the DATE() function, and group by that.

提交回复
热议问题