Consider the following example:
+---------+------------+
| value | name |
+---------+------------+
| 42 | abresas |
| 0 | dionyziz |
| 6 | dionyziz2 |
| 0 | izual |
| 8 | kokos |
| 37 | kostis90gr |
| 0 | test |
| 35 | usertest |
+---------+------------+
I want to sort this in ascending order of value but I want all the names with value 0 to display at bottom. So the sort order should be:
6,8,35,37,42,0,0,0
Any idea if this is possible with sql or not?
Sure. Use the IF function: