programming-examples/sql/AggregateFunctions/Write a SQL statement to find the highest purchase amount with their ID and order date, for those customers who have a higher purchase.sql
2019-11-18 14:05:53 +01:00

6 lines
335 B
SQL

/*Write a SQL statement to find the highest purchase amount with their ID and order date,
for those customers who have a higher purchase amount in a day is within the range 2000 and 6000.*/
SELECT customer_id,ord_date,MAX(purch_amt)
FROM orders
GROUP BY customer_id,ord_date
HAVING MAX(purch_amt) BETWEEN 2000 AND 6000;