Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8059535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:42:05+00:00 2026-06-05T09:42:05+00:00

Below is what I have id | Total | Area 1 | 19 |

  • 0

Below is what I have

id    |  Total    | Area
  1   |    19     |  A
  2   |    20     |  B
  3   |    19     |  C
  4   |    20     |  A
  5   |    19     |  D

What I want is as below.

id    |  Total    | Area
  4   |    20     |  A
  2   |    20     |  B
  1   |    19     |  A
  3   |    19     |  C
  5   |    19     |  D

I was trying as

SELECT * FROM myTable
ORDER BY Total, Area DESC

By using above code I can sort the Total in descending order, however how to order Area column at the same time? Any idea?

I am closing this question as I got answer

SELECT * FROM myTable
ORDER BY Total DESC, Area ASC

Demo

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:42:07+00:00Added an answer on June 5, 2026 at 9:42 am

    Each column/expression in an ORDER BY clause can have its own order (ASC/DESC, ASC is the default if not specified). You can write:

    SELECT * FROM myTable
    ORDER BY Total DESC, Area /* ASC */
    

    Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below I have a jquery code which includes a textbox where the user can
Look at the test code I have written below. Using pure java I set
Below I have a line of code where it states which Session a user
below i have a code that runs in most of my simple programs ..
I have below snippet of code in which TestClass is extending jPanel which is
I have below code: <a href=# id=@item.Id name=vote ><img src=/Content/images/021.png style=float:left alt= /></a> which
I have below HTML code <table class=innerGridTable cellpadding=0 cellspacing=0 width=100%> <tr id=trMain> <td> <asp:Button
I have a total of 8 messages being passed on 4 nodes using MPI.
Please have a look at my code below. It's not working and I don't
I have a list of dictionaries as shown below. Each dictionary holds the total

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.