mysql - Sorting numbers string with letter -


i have strings such

70x100 cm 70x140 cm 70x70 cm 72x120 cm 70x130x70 cm 70x75x70 cm 72x72 cm 

when want sort in order:

70x70 cm 70x75x70 cm 70x100 cm 70x130x70 cm 70x140 cm 72x72 cm 72x120 cm 

this code:

order cast(cast(eaov.value decimal(3,0)) unsigned integer), eaov.value 

any ideas?

a minor mod answer strawberry. changing 'cm' series of x0 ensure there 3 dimensions sort order

select * eaov order cast(substring_index(replace(eaov.value, ' cm', 'x0x0x0'), 'x', 1) unsigned integer),         cast(substring_index(substring_index(replace(eaov.value, ' cm', 'x0x0x0'), 'x', 2), 'x', -1) unsigned integer),         cast(substring_index(substring_index(replace(eaov.value, ' cm', 'x0x0x0'), 'x', 2), 'x', -1) unsigned integer) 

performance not strong point.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -