SQL Exercises: Highest purchase amount on a particular date for individual salesman
SQL Aggregate Functions: Exercise-11 with Solution
Write a SQL statement to find the highest purchase amount on a date '2012-08-17' for each salesman with their ID.
Sample table: orders
Sample Solution :
SELECT salesman_id,MAX(purch_amt) FROM orders WHERE ord_date = '2012-08-17' GROUP BY salesman_id;
Output of the Query:
salesman_id max 5003 110.50 5007 75.29
Pictorial presentation :
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a SQL statement to find the highest purchase amount ordered by the each customer on a particular date with their ID, order date and highest purchase amount.
Next: 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.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework