ORDER BY problem in MYSQL
Posted: Tue Jul 30, 2002 3:34 pm
I have some interger data that I want to display in a table and order in ASC order. The problem is that because some of the values are zero they come first in the table when really I want the first value in the table to be a 1. This is because although zero is less than 1 I don't want it to be the 'top' number (this data makes up a sort of leaderboard and zero means that the person hasn't scored yet but does exist, and obviously they shouldn't come above someone who HAS scored.)
Now I could say WHERE data>'0' ORDER BY data but I still want to display the zero values - just below all the others.
What I think I really need is the correct syntax to say:
WHERE data> = 0' ORDER BY something else OR WHERE data>'0' ORDER BY data.
To put it another way what I want to achieve is a list ordered like the following:
1
2
5
7.8
8.3
10.
11
15
0
0
0
0
Can this be done somehow with MYSQL?
Now I could say WHERE data>'0' ORDER BY data but I still want to display the zero values - just below all the others.
What I think I really need is the correct syntax to say:
WHERE data> = 0' ORDER BY something else OR WHERE data>'0' ORDER BY data.
To put it another way what I want to achieve is a list ordered like the following:
1
2
5
7.8
8.3
10.
11
15
0
0
0
0
Can this be done somehow with MYSQL?