May 14, 2007 #1 S sheriff New member Joined May 14, 2007 Messages 2 Hi all I have the following data Doc# Date 1 2 Jan 2007 2 10 May 2007 2 14 May 2007 I want the latest entry for each document. Results should look like this: Doc# Date 1 2 Jan 2007 2 14 May 2007 How do I go about doing this? Thanks in advance
Hi all I have the following data Doc# Date 1 2 Jan 2007 2 10 May 2007 2 14 May 2007 I want the latest entry for each document. Results should look like this: Doc# Date 1 2 Jan 2007 2 14 May 2007 How do I go about doing this? Thanks in advance
May 14, 2007 #2 Nerseus Danner Joined Oct 22, 2002 Messages 2,547 Location Arizona, USA User Rank *Expert* Two keys elements are needed: "GROUP BY" and "MAX". For your simple query, heres the SQL: Code: SELECT [Doc#], MAX(Date) AS [Date] FROM Table1 GROUP BY [Doc#] -ners
Two keys elements are needed: "GROUP BY" and "MAX". For your simple query, heres the SQL: Code: SELECT [Doc#], MAX(Date) AS [Date] FROM Table1 GROUP BY [Doc#] -ners
May 15, 2007 #3 S sheriff New member Joined May 14, 2007 Messages 2 thanks a lot! exactly what i needed