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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 10 Highest Value in ASC order

Author  Topic 

solisjojo
Starting Member

4 Posts

Posted - 2005-05-24 : 04:37:42

Hi Everyone,

let say in a table i have million records and i want to get the last 10 highest value, i want the results to be in ASC order, How would i get it? please help

saple data:
Table name : tb1
Col name : Col1

COL1:
1
5
7
8
9
10
13
16
18
19
23
34
35
45
50

I want the result to be like this:
Output
col1:
10
13
16
18
19
23
34
35
45
50


Please help
Thanks!

jojo Solis

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-05-24 : 04:53:00

Select col1 from (
select top 10 col1 from tb1 order by col1 desc
) T order by col1 Asc




Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

solisjojo
Starting Member

4 Posts

Posted - 2005-05-24 : 05:12:02
WOW!
it works perfectly!

thanks a lot!
Go to Top of Page
   

- Advertisement -