Get Distinct Maximum Date
Get Distinct Maximum Date
Display the latest order of each customers.
SELECT A.CustomerID, OrderDate, EmployeeID, ShipperID FROM Orders AS A INNER JOIN
(SELECT CustomerID, MAX(OrderDate) AS MaxOrderDate FROM Orders GROUP BY CustomerID) AS B
ON A.CustomerID=B.CustomerID AND A.OrderDate=B.MaxOrderDate
Comments