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 |
delboy2006
Starting Member
4 Posts |
Posted - 2006-01-08 : 10:06:45
|
Hi, Im having trouble selecting the bottom 5 results fo an sql query.if for example I have a result set of numbers from 1 - 10, the below sql query will return the bottom 5 results but back to front.SELECT TOP 5 id, nameFROM t_projectsORDER BY DESCbasically the above returns 10,9,8,7,6, but I want it to return 6,7,8,9,10can anybody help?Thanks in advance |
|
sachinsamuel
Constraint Violating Yak Guru
383 Posts |
Posted - 2006-01-08 : 10:22:31
|
Tryselect * from ( SELECT TOP 5 id, name FROM t_projects ORDER BY id DESC)Aorder by A.IdRegardsSachinDon't sit back because of failure. It will come back to check if you still available. -- Binu |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-01-08 : 10:23:37
|
[code]Select * from (SELECT TOP 5 id, name FROM t_projects ORDER BY id DESC) as Q1order by id[/code] |
|
|
delboy2006
Starting Member
4 Posts |
Posted - 2006-01-08 : 10:31:57
|
thanks, that works a treat. Much appreciated! |
|
|
|
|
|
|
|