i have a column that contains data like this:
{Population: 1331415} {Population: 44234} {Population: 214124212} {Population: 222222}
i need to order the database by the number after {Population: ,and by another column called Name(it contains names of cities)
One method is to use the length and the value:
order by length(col) desc, col desc
Another is to extract the numeric value and convert it to a number:
order by substring_index(col, ': ', -1) + 0 desc
1.4m articles
1.4m replys
5 comments
57.0k users