Answer the question
In order to leave comments, you need to log in
How to set advanced sorting?
I need to sort a string as a number. For this I use:
select * from `panel` order by cast(town as unsigned) asc LIMIT 20
'town' => [
'asc' => ['town' => SORT_ASC],
'desc' => ['town' => SORT_DESC]
],
'town' => [
'asc' => 'cast(town as unsigned) asc',
'desc' => 'cast(town as unsigned) desc
],
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question