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 |
|
anubhav
Starting Member
1 Post |
Posted - 2006-06-01 : 05:20:33
|
| Can any one suggest me a query to find n highest values of a column from a table, I mean all the n not the nth or Highest.for example: to find top ten salaries from an employee table. |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-06-01 : 05:23:11
|
| Did you meanSelect Top n From Table??If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-06-01 : 05:24:58
|
Always use ORDER BY with TOPSELECT TOP 10 SALARY FROM EMPLOYEE ORDER BY SALARY DESC KH |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-01 : 06:27:56
|
| If you want it generalise thenDeclare @top intSet @top=10Set RowCount @topSELECT SALARY FROM EMPLOYEE ORDER BY SALARY DESCSet RowCount 0MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|