Customer Revenue In March

Calculate the total revenue from each customer in March 2019. Include only customers who were active in March 2019.

Output the revenue along with the customer id and sort the results based on the revenue in descending order.

table name: orders
Solution:
select cust_id, sum(total_order_cost) as revenu from orders where year(order_date) = 2019 and month(order_date) = 3  group by cust_id
order by sum(total_order_cost) desc
Output:


Comments (0)