SQLite Forum

ORDER BY not working for a specific DB/table
Login
Simply create the index using the rounded values rather than the raw values and search/order using that index.  Then the cost of doing the round operation will be paid when you insert/update rather than when you query.

ie:
```
create index r_latiSaltxi on latiSaltxi(round(lati10,6), round(longi,6));
```
done once, and then the query below will execute no round() functions
```
  select WestCCod, round(lati10,6), round(longi,6)
    from latiSaltxi 
   where round(lati10,6) between 41 and 41.3
order by round(lati10,6), round(longi,6);
```