Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sbb1979
Starting Member
1 Post |
Posted - 2006-12-07 : 10:52:28
|
| Hello,I'm reasonably new to SQL.I have a table of information about meetings with various people. In it, I have the person's name and the date/time of the meeting (simplified example).I need to write a query that SELECTs only the most recent meeting for each person.Any ideas would be greatly appreciated. |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-12-07 : 11:11:56
|
| SELECT *FROM MeetingsINNER JOIN (SELECT PersonID, max(MeetingDate) AS MeetingDate FROM Meetings GROUP BY PersonID) Recent ON Meetings.PersonID = Recent.PersonID AND Meetings.MeetingDate = Recent.MeetingDate |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|