programming-examples/sql/AggregateFunctions/Write a SQL statement to find the highest purchase amount with their ID, for only those salesmen whose ID is within the range 5003 and 5008.sql

6 lines
268 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, for only those salesmen
whose ID is within the range 5003 and 5008.*/
SELECT salesman_id,MAX(purch_amt)
FROM orders
GROUP BY salesman_id
HAVING salesman_id BETWEEN 5003 AND 5008;