programming-examples/sql/AggregateFunctions/Write a SQL statement to find the highest purchase amount with their ID and order date, for only those customers who have highest purchase amount in a day is more than 2000.sql

6 lines
309 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*Write a SQL statement to find the highest purchase amount with their ID and order date, for only those customers who have
highest purchase amount in a day is more than 2000.*/
SELECT customer_id,ord_date,MAX(purch_amt)
FROM orders
GROUP BY customer_id,ord_date
HAVING MAX(purch_amt)>2000.00;