We are rewriting our CMS at the moment, and we want our customers to be able to reorder items in the table using the "position" field. So, if they mark positions as position 1, it goes up, then position 2 below it, etc.
The problem is that we donβt want them to fill out a position every time, only if they want to reorder something, so the position field will often be blank. Therefore, you may have the following ...
Car - 1
Bike - 2
House
A computer
Dog
This causes a problem because if you use the following SQL ...
SELECT ProductName FROM Products ORDER BY Position DESC;
All spaces go up, not down.
Can I put them in the correct order using an SQL statement?