|
-
Apr 30th, 2009, 02:46 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Select Max Date
I have some records in a table, where I want to grab the most recent date and the other data associated with it. It's so simple when I think about it, but I just can't seem to write SQL that does what I want. (this is SQL Server 2005, by the way).
Example.
I have Person1, Person2, and Person3. Each person has a distinct date associated with it. I want to grab the Person field along with the max date, but I don't want to group by, because it will list all 3 persons. Does that make sense?
Select Max(Date), Person From Person, it forces me to add a Group By Person, but then it lists all 3 Persons. It's annoying to say the least.
-
Apr 30th, 2009, 02:50 PM
#2
Re: Select Max Date
Select Person,Date From Person Where Date = (Select Max(Date) From Person)
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Apr 30th, 2009, 03:03 PM
#3
Thread Starter
Addicted Member
Re: Select Max Date
Yes, now I feel stupid. Thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|