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 |
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2010-03-05 : 06:31:06
|
| Hello All,I want to get 2nd largest number from my selected records, is there any way by which it can be achieved(remeber I dont want to use sub query for this purpose) |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-03-05 : 06:38:19
|
select top 1 number from(select top 2 number from table order by number desc)dtorder by number asc No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-03-05 : 06:40:02
|
| On which columns?Please post some sample data.PBUH |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-03-05 : 08:30:22
|
quote: Originally posted by webfred
quote: Originally posted by madhivanan Also referhttp://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/find-nth-maximum-value.aspxMadhivananFailing to plan is Planning to fail
Hi madhi,in this link I don't understand the first approach:(1) Use Inner JoinI think there is a part of code missing. No, you're never too old to Yak'n'Roll if you're too young to die.
Thanks. Some part of code was not visible. I corrected it now MadhivananFailing to plan is Planning to fail |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-03-05 : 08:40:04
|
Now it looks better but it cannot work. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-03-05 : 09:35:27
|
quote: Originally posted by webfred Now it looks better but it cannot work. No, you're never too old to Yak'n'Roll if you're too young to die.
Thanks. Still there was a problem in displaying the codeI corrected itThanks for Testing MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|