7 lines
342 B
MySQL
7 lines
342 B
MySQL
|
/*Write a SQL statement to make a report with customer ID in such a manner that, the largest number of orders booked by the
|
||
|
customer will come first along with their highest purchase amount.*/
|
||
|
SELECT customer_id, COUNT(DISTINCT ord_no),
|
||
|
MAX(purch_amt)
|
||
|
FROM orders
|
||
|
GROUP BY customer_id
|
||
|
ORDER BY 2 DESC;
|