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 - 2006-10-17 : 07:54:55
|
david writes "i have a table named guest. everytime a guest logs in, my database creates an entry with their name and another column with the date they logged in. there are multiple entries with the same name. i would like to just see a single record for each name showing the most recent date that they logged in. any ideas? i'm using SQL2000 with windows 2003exampledavid 10/15/2006david 10/13/2006david 10/10/2006mark 10/14/2006mark 10/10/2006i need the query results to be the most recent datedavid 10/15/2006mark 10/14/2006" |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-10-17 : 08:31:14
|
[code]select *from guest gwhere datecol = (select max(datecol) from quest x where x.name = g.name)[/code] KH |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-10-17 : 10:30:58
|
orSelect name, max(date) as date from tableGroup by nameMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|