sql >> Base de Datos >  >> RDS >> Mysql

orden de unión sql

   SELECT *
   FROM students
   ORDER BY IF(height >= 150, 1,0 ) DESC, 
            IF(height >= 150, name, '') ASC, 
            name DESC

salida de muestra

+------+--------+
| name | height |
+------+--------+
| a    |    189 |
| m    |    666 |
| thy  |    166 |
| yyy  |   1277 |
| zz   |    101 |
| swq  |    122 |
| n    |    111 |
| g    |    145 |
+------+--------+