March 27, 2008 at 8:31 am
Brain freeze! Using the following example:
Lastname FirstName DateModified
Smith Jim 1/14/07
Smith Jim 2/28/08
Richardson Alex 5/15/07
Richardson Alex 7/05/07
etc...
How can I return only the latest date modified *for each Lastname Firstname combination* (aka exclude the older dates modified)?
(I'll be using the resulting dates modified from the subset to match against an original table)
March 27, 2008 at 8:37 am
Todd Biggins (3/27/2008)
Brain freeze! Using the following example:Lastname FirstName DateModified
Smith Jim 1/14/07
Smith Jim 2/28/08
Richardson Alex 5/15/07
Richardson Alex 7/05/07
etc...
How can I return only the latest date modified (aka exclude the older dates modified)?
(I'll be using the resulting dates modified from the subset to match against an original table)
I think this is what you are looking for:
select
Lastname,
Firstname,
max(DateModified) as DateModified
from
dbo.MyTable
group by
Lastname,
Firstname
😎
March 27, 2008 at 8:38 am
AWESOME!!! Thanks!!!!
March 27, 2008 at 8:46 am
Your welcome. I've been there with the brain freeze issue.
😎
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply