Sort numbers (and numbers + letters) using sqlite

I am trying to sort a VarChar field with Sqlite.

A field can contain numbers or numbers + letters, but I need to sort them in the order of numbers, for example:

1
1a
1b
5
5x
5y
10
10d
10e
10g1
eleven
11a
11b
100c
100f

Any ideas? I was able to do this ... this is close (but not quite) what I need:

Enter the initial field with the field "00000", and then sort by the first letter

+3
source share
2 answers

Easy

select col from tbl order by col*1, col
+11
source
+1

Source: https://habr.com/ru/post/1796202/


All Articles