android - SQLITE, Group by range of 1000s -


i have database of 2 columns in sqlite android

  id (int)     | owner (varchar)   1477            jack  1578            jill  :               :  9277            hill  

1) count of following: - (group 1000s range)

range    | count 0-999      0 1000-1999  5 : 8999-9999  7 

2) count of following: - (group 100s range)

range    | count x1xx       5 x2xx       6 : x9xx       7 

3) , group 10s range.

i'm stuck how group by

select count(*) mytable  group ?? 

any pointers appreciated.

integer division integers in sqlite3 yields integers:

select id/1000 range_id, count(*) range_count mytable group range_id; 

to group 100 ids, change 1000 100

sqlite3 has printf() function might useful in make pretty column describe range if need prettier integer division of id group size.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -