php - Ordering versions in not lexicographical order -


this question has answer here:

i need sort versions extract db query .

right , sort order follows :

1.1.0 1.10.2 1.2.3 1.4 

but wish were:

1.1.0 1.2.3 1.4 1.10.2  

how can this?

try this

select * tab order cast(substring_index(ver, '.', 1) unsigned ),        cast(substring_index(substring_index( ver , '.', 2 ),'.',-1) unsigned ) ,               cast(substring_index(ver, '.', -1) unsigned ) 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -