Re: order by confusion

2005-05-03 Thread gerald_clark
Schalk Neethling wrote:
Greetings!
This might be a stupid question but here goes:
I have a table that contains a column entitled current_pos. I want to 
search this table and then order the results by current_pos. Now I am 
running the following SQL query on the table:

SELECT * FROM ab_leader_board WHERE sex = 'F' and cup = 'Kids' ORDER 
BY current_pos DESC;

After running this the results are returned  but as 2, 1, 0 , 0 etc.
If I use: SELECT * FROM ab_leader_board WHERE sex = 'F' and cup = 
'Kids' ORDER BY current_pos ASC;

It returns 0, 1, 2
How do I go about getting this to return the results as 1,2,3,4 etc.? 
Any help would be appreciated. Thank you!

Well, since the results are 0, 1, 2 you are not going to get 1,2,3,4.
You are getting what you are asking for, and it appears to be what you 
want, so what is the problem?
A bit more detail and a real example might help.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: order by confusion

2005-05-03 Thread Jay Blanchard
[snip]
This might be a stupid question but here goes:

I have a table that contains a column entitled current_pos. I want to 
search this table and then order the results by current_pos. Now I am 
running the following SQL query on the table:

SELECT * FROM ab_leader_board WHERE sex = 'F' and cup = 'Kids' ORDER BY 
current_pos DESC;

After running this the results are returned  but as 2, 1, 0 , 0 etc.

If I use: SELECT * FROM ab_leader_board WHERE sex = 'F' and cup = 'Kids'

ORDER BY current_pos ASC;

It returns 0, 1, 2

How do I go about getting this to return the results as 1,2,3,4 etc.? 
Any help would be appreciated. Thank you!
[/snip]

So, is 1 == 0? Or do you need to start with any non-zero position?

If I use: SELECT * 
FROM ab_leader_board 
WHERE sex = 'F' 
AND cup = 'Kids'
AND current_pos > '0'
ORDER BY current_pos ASC;

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]