Posted by Sai, Jan. 4, 2024, 10:45 p.m.
10. Min and max spend
- Write a query to return the minimum and maximum customer total spend in June 2020.
- For each customer, first calculate their total spend in June 2020.
- Then use
MIN, andMAXfunction to return the min and max customer spend .
SELECT min(amount),max(amount)
FROM payment
GROUP BY extract(month from payment_ts) ,extract(year from payment_ts)
HAVING extract(month from payment_ts)=6 AND extract(year from payment_ts)=2020
can some one help me with the modifications i need to do get the desired output