-3

my table is

+-----------+--------+--------+
| Name      | Weight | Height |
+-----------+--------+--------+
| Amin      |     75 |    180 |
| Mahdi     |     90 |    190 |
| Moahammad |     75 |    175 |
| Ahmad     |     60 |    175 |
+-----------+--------+--------+

I want sort a table from bigger Height and if Height is equal print lower weight first. and the result like this

Mahdi 190 90
Amin 180 75
Ahmad 175 60
Mohammad 175 75
fariborz najafi
  • 69
  • 1
  • 2
  • 8

1 Answers1

0

Use height as descending order then weight in ascending order

select name, hieght, weight
from tablename
order by height desc, weight
Fahmi
  • 37,315
  • 5
  • 22
  • 31