how to sort top max n values in ms sql server

Posted on 2006-05-09
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..
Question by:gmnasir
    LVL 16

    Accepted Solution

    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


    LVL 5

    Assisted Solution

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, ( because one time I did this and I essentially had a bricked …
    Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now