php - Ordering versions in not lexicographical order -
this question has answer here:
- mysql sorting of version numbers 3 answers
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
Post a Comment