UBB.Dev
Posted By: Gardener Sort on fields with NULL values - 12/22/2002 2:44 PM
I have a problem on my server (running MySQL 4.0.6) when sorting on fields that have NULL values... The rows with NULL in the order by field always shows up first both on ASC and DESC. Because of this, the empty rows always shows on the first page on the user list for example, not very user friendly. I just noticed that this is not the case here at td, so I'm figuring it's either to do with the MySQL-version or some configure option.

The MySQL manual is a bit indecisive about the fact, in one place it says that NULL values always shows up first, and in another place it says NULL values are listed at the bottom when sorting on DESC.

Does anyone have any insight on this?
Posted By: Dave_L_dup1 Re: Sort on fields with NULL values - 12/22/2002 5:24 PM
I just did a couple of tests using MySQL 3.23.45. With ASC, the NULL values are at the beginning. With DESC, they're at the end.

What's the actual query you're using?
Posted By: Gardener Re: Sort on fields with NULL values - 12/24/2002 4:43 PM
It doesn't matter which query I'm using. It happens on all queries where there are null values in the order by field.

Try sorting on Homepage or something in the userlist on my site and you'll see what happens:
http://forum.rollspel.nu/
© UBB.Developers