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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-01-30 : 08:20:58
|
Michael writes "I have a simple table as follow (sample of contents only)SessionGroup SessionDate------------ -----------16 1/22/200317 1/30/200318 1/29/200318 2/5/200318 2/26/200318 3/5/200322 1/15/200322 1/19/200322 2/6/200322 3/6/2003 and so forth. Each line has a session group and the date that session occurs, some session groups have multiple dates, and as such, multiple lines with the same sessiongroup but different dates.What I would like is a single recordset consisting of the last date of each session and the sessiongroup number. (there's other stuff in the table, but it's not necessary information. I would very much like to avoid the use of a temporary table even though I know I could do it that way with finding the largest date of a given session group, inserting that into the temporary table, and then moving on to the next sessiongroup.Any help is appreciated!" |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2003-01-30 : 08:32:58
|
| SELECT SessionGroup, Max(SessionDate)FROM SessionsGROUP BY SessionGroup |
 |
|
|
|
|
|