-1

I have a table like this:

Age | Points
-------
22  | 5000   
15  | 100
22  | 45
14  | 50
13  | 10
12  | 500
11  | 356
15  | 25

And I like a result like this (first I order table by age and then for each age I order by points):

Age | Points
-------
22  | 5000 
22  | 45
15  | 100
15  | 25
14  | 50
13  | 10
12  | 500
11  | 356

How can I do it through SQL?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

4 Answers4

2
select * from your_table
order by age desc, points desc
juergen d
  • 201,996
  • 37
  • 293
  • 362
1
select * 
from TableName
order by Age desc, Points desc
Flea777
  • 1,012
  • 9
  • 21
0

use order by clause

select * from TABLE 
order by age ,points desc
Mahesh Madushanka
  • 2,902
  • 2
  • 14
  • 28
0
select * 
from TableName
order by Age desc, Points desc
Asif patel
  • 35
  • 7
  • Code-only answers are considered poor-quality content on Stack Overflow. Please provide information about why this answers the question. Copying another answer verbatim is considered very poor form, and without any kind of commentary, this looks very bad. – Michael Gaskill Jul 05 '16 at 15:16