I
I
Ilya2021-08-23 19:40:56
SQL
Ilya, 2021-08-23 19:40:56

How to solve a SQL problem?

task description:
The database table contains the following columns:
Sales(Date, ProdID, OrderID, ManagerID, Sum)
Write an SQL query that will show the manager with the highest sales for specific orders in 2019 (by months).
The query must return the Month, Manager (ManagerID), Order Numbers (OrderID) and Sum.

My decision:

SELECT MONTH(DATE), ManagerID AS Менеджер, OrderID AS Номера заказов, max(Sum)  AS Сумма
FROM Sales
WHERE Sum = max(Sum) and YEAR(DATE) = 2019;


How to fix the request so that it works correctly?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question