Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
BBoyd
Starting Member
4 Posts |
Posted - 2012-02-15 : 06:01:22
|
I have what would appear to be a very simple question except for anyone just starting out like myself.The question: Show the EmployeeID and the most recent order date (called Latest Order)for each employee.When I tried to narrow the following code with WHERE and/or HAVING, I get errors. Where am I going wrong?SELECT DISTINCT EmployeeID, (OrderDate) AS [Latest Order]FROM Orders; |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2012-02-15 : 06:21:38
|
SELECT EmployeeID, MAX(OrderDate)FROM dbo.OrdersGROUP BY EmployeeID N 56°04'39.26"E 12°55'05.63" |
 |
|
|
BBoyd
Starting Member
4 Posts |
Posted - 2012-02-15 : 06:41:25
|
| Thank you very much. That did the trick. |
 |
|
|
|
|
|