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 |
|
SCHEMA
Posting Yak Master
192 Posts |
Posted - 2009-05-19 : 13:14:17
|
| I have tableid compno date1 2 5/5/091 2 5/5/091 2 5/5/091 3 3/5/091 3 3/5/09How do i get?id compno date1 2 5/5/091 2 5/5/091 2 5/5/09Thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-19 : 13:23:31
|
| [code]SELECT t.*FROM table tJOIN (SELECT id,max(date) as latest FROM table GROUP BY id) t1on t.id=t1.idand t.date=t1.latest[/code] |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-05-20 : 05:51:30
|
| select * from @temp where date = ( select max(Date) from @temp) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-05-20 : 06:25:43
|
| Both will gie the difference result. Only OP should tell us which is neededMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|