Log in

View Full Version : Find Latest Date



Djblois
07-26-2011, 07:14 AM
Say I have a Table with Two columns. First Column has [Product Code] and the second column has [Posted Date] then it has more columns with data but I need to filter by these two columns. The Table will have multiple [Posted Date] for the [Product Code]. I need to find the latest [Posted Date] for all [Product Code]. I cannot think of how to do this?

hansup
07-26-2011, 09:33 AM
Try a query which groups by Product Code, and returns the Max() Posted Date for each group.

SELECT [Product Code], Max([Posted Date]) AS latest_posted_date
FROM YourTable
GROUP BY [Product Code];