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 |
|
Deepa_tarak
Starting Member
2 Posts |
Posted - 2004-09-19 : 14:10:08
|
| "Hello guys. How can I a specific row alone from a queries result?Take the EMPLOYEE table. Say I want to get only the second highest paid employee or third highest employee. Or I specifically just want the second row alone or third row alone from a query? How do I do that?”SQL Server 7.0 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-09-19 : 14:14:40
|
| select top 1 *from (select top 3 * from employees order by salary desc) a order by salary==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
Deepa_tarak
Starting Member
2 Posts |
Posted - 2004-09-19 : 14:54:52
|
| Thanx for the reply. How do i do it if i dont have any specific field on which to order it by & i just want the second row or third row retreived? |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-19 : 15:07:37
|
in order to use the concept of n-th row from top or bottom, you need to order on something.that's because the data in tables isn't stored in any particular order.Go with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|