Most recent order date for all employees

T

Tina

I have a school assignment where I'm supposed to pull the above info using
SQL statements. I looked thru old postings & tried this:

SELECT EmployeeID, OrderDate
FROM Orders
WHERE OrderDate =
(SELECT Max(OrderDate) FROM Orders);

It gave me the below & didn't include the other employees whose most recent
order was earlier than this date:

EmployeeID OrderDate
1 05-Jun-96
4 05-Jun-96
7 05-Jun-96
8 05-Jun-96
 
S

Smartin

Tina said:
I have a school assignment where I'm supposed to pull the above info using
SQL statements. I looked thru old postings & tried this:

SELECT EmployeeID, OrderDate
FROM Orders
WHERE OrderDate =
(SELECT Max(OrderDate) FROM Orders);

It gave me the below & didn't include the other employees whose most recent
order was earlier than this date:

EmployeeID OrderDate
1 05-Jun-96
4 05-Jun-96
7 05-Jun-96
8 05-Jun-96

To paraphrase your assignment: "Most recent order date *by employee*"
suggests you need a GROUP BY clause somewhere?
 
Top