android – sqllite sort by address

Question:

in the database ( SQL-Lite ) there is an address field (field type text)

For instance:

468464, Москва, Ленина, 14, 1
468464, Москва, Ленина, 14, 2
468464, Москва, Ленина, 14, 3
468464, Москва, Ленина, 14, 10
468464, Москва, Ленина, д.14, кв12
468464, Москва, Ленина, д, 14, 13 кв

Correct order:

ул, 14, 1
ул, 14, 2
ул, 14, 3
ул, 14, 10
ул, 14, 20

but in reality it turns out like this:

ул, 14, 1
ул, 14, 10
ул, 14, 2
ул, 14, 20
ул, 14, 3

Those. just order by addressColumn doesn't work. How can this problem be solved?

* UP

Is it possible with a sql query from line 468464 , Moscow, Lenina, d, 14 , 13 sq. To leave only numbers? 4684641413

Answer:

Add some new fields. Enter the information from the field with the general address in them, breaking it down into components. Create a composite index on these new fields.

Scroll to Top