query to get only latest entries (1 Viewer)

arm1

Registered User.
Local time
Today, 17:13
Joined
Nov 21, 2006
Messages
40
I am having difficulty formulating this query.

I have 2 tables... 1 is customer info (name, address, etc...), and the second is shipments (ShipToCustomerName, ShipmentDate, etc...).

Now, I wish to query the shipments table to get ONLY the LATEST shipment information for EACH customer.

If customer A has a shipment in Jan 1, Feb 2, and March 3... while customer B has a shipment in April 4 and May 5. then the result of the query should be

customer A - March 3
customer B - May 5

Is there a simple way to construct such a query?!?

Thank you for your help,

- arm
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:13
Joined
Aug 30, 2003
Messages
36,126
SELECT Customer, Max(DateField) AS LastDate
FROM TableName
GROUP BY Customer
 

Users who are viewing this thread

Top Bottom