I have the following 4 rows in a table
Company JobNumber BeginDate ModifyDate
1 2 12/12/2005 11/12/2006
1 2 12/12/2005 11/15/2006
2 3 11/12/2005 1/12/2006
2 3 11/12/2005 9/15/2006
The company and Job Number make up the key so yes this table has duplicate keys. My question is how would I return the two keys with the max modify date?
So the results would look like this:
1 2 12/12/2005 11/15/2006
2 3 11/12/2005 9/15/2006
Thanks,
SELECT Company, JobNumber, BeginDate, MAX(ModifyDate)
FROM blah
GROUP BY Company, JobNumber, BeginDate
|||Thanks, works great!
No comments:
Post a Comment