Hi everyone.
I have two tables in the same DB. They both contain alphanumeric codes like "XX123". (one looks up the other) I need to do a natural sort on these in both tables. In one table if I use the trick +0 it works perfectly :
However in the other table
produces no obvious sort at all. However I know the syntax is ok as leaving out the +0 gives the expected result (which is not a natural search)
I can only think there is some difference in the tables? The field in question is a varchar 15 characters in both and the second one has been populated by the first. The only difference I can see is in the one that works NULL=No Default = blank and in the non working one NULL=Yes and Default=Null but I cant see why this would affect it
I don't have much hair but this is causing the remaining to fall out!
your help most appreciated
I have two tables in the same DB. They both contain alphanumeric codes like "XX123". (one looks up the other) I need to do a natural sort on these in both tables. In one table if I use the trick +0 it works perfectly :
Code:
SELECT * FROM `thistable` ORDER BY `thiscode` + 0 ASC
Code:
SELECT * FROM `product_master_file` ORDER BY `thiscode`+ 0 ASC
I can only think there is some difference in the tables? The field in question is a varchar 15 characters in both and the second one has been populated by the first. The only difference I can see is in the one that works NULL=No Default = blank and in the non working one NULL=Yes and Default=Null but I cant see why this would affect it
I don't have much hair but this is causing the remaining to fall out!
your help most appreciated
Comment