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 - 2004-04-26 : 11:30:00
|
| dhiraj writes "to find out second highest id from a data base .The id's are not in a continuous order" |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-04-26 : 11:42:36
|
| SELECT a.idFROM (SELECT TOP 2 id FROM table1 ORDER by id desc) aWHERE a.id NOT IN (SELECT max(id) from table1)Duane. |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2004-04-26 : 11:46:12
|
| ORSELECT TOP 1 a.idFROM table1 aWHERE a.id NOT IN (SELECT max(id) from table1)ORDER by id descDamian |
 |
|
|
|
|
|