Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to sort top max n values in ms sql server

Posted on 2006-05-09
4
Medium Priority
?
469 Views
Last Modified: 2012-06-21
hi, i want to get the higest value first.  like how can i sort value in the table is such a way that they should be arranged by top max n value..
0
Comment
Question by:gmnasir
2 Comments
 
LVL 16

Accepted Solution

by:
Wadski earned 500 total points
ID: 16637710
Hi there gmnasir,

at the bottom of your sql statement you need to add:

Order By VALUE desc

W3schools has a tutorial on ordering SQL Statements

http://www.w3schools.com/sql/sql_orderby.asp

Regards

Wadski
0
 
LVL 5

Assisted Solution

by:brady1408
brady1408 earned 500 total points
ID: 16640021
you might have better luck in the db section under microsoft sql but in the mean time you can sort by doing this

Select * from Table Order By Field Asc or Desc you canuse as many fields as you like just seperate them with a comma
SELECT * FROM Table ORDER BY FieldA DESC, FieldB ASC, FieldC ASC
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
The article covers five tools all IT professionals should know about, as they up productivity by a great deal!
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question