Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

max(Date) to return most recent dates 1

Status
Not open for further replies.

Vie

Technical User
Jan 22, 2004
115
US
I found a couple of threads that partly addressed my question but still was not able to make the solutions work for my particular situation.

I need something like the following:

SELECT * FROM tblNames (join type tblDates...)
WHERE (SELECT max(DeliveryDate)
FROM tblDates)
WHERE tblNames.NameID = tblDates.NameID

The result is all the names and all the deliverydates for each name, not just the most recent one.

Can anyone steer me in the right direction on this?

Thanks,
Vie
 
You didn't indicate what you wanted but this will give you the data for the most recent delivery date for each NameID.

SELECT *
FROM tblNames join type tblDates
on tblNames.NameID=tblDates.NameID
WHERE tblDates.DeliveryDate=(SELECT max(DeliveryDate)
FROM tblDates as a
where a.NameID=tblNames.NameID)
 
Thanks JonFer. That was the ticket!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top