PDA

View Full Version : SQL "ORDER BY" question


Cloudrunner
05-29-2005, 09:27 PM
One more folks ;)

"SELECT * FROM ".TABLE_PREFIX."table ORDER BY total DESC LIMIT 0,5";Given that statement, if I have data in the totals column that equals 9687, and data that has 987 in the totals column, it outputs that the number 987 is bigger (thus comes first) than 9687. How do I make it do real counting in the SQL statement (i.e. 9687 is bigger than 987 thus 9687 is displayed first).

Thanks!

)O( Cloudrunner )O(

Paul M
05-29-2005, 09:48 PM
The only way that I can see 987 would come out bigger than 9687 is if it's a text field, not a numeric field, in which case you should fix the basic problem of the field type (for 'total') being wrong.

Cloudrunner
05-29-2005, 10:50 PM
The only way that I can see 987 would come out bigger than 9687 is if it's a text field, not a numeric field, in which case you should fix the basic problem of the field type (for 'total') being wrong.
Well duh...

Thank you Paul! Fixed the problem right off.

Paul M
05-30-2005, 10:06 AM
Good. :)