jeudi 18 juin 2015

SQLITE, Group by range of 1000s

I have a database of two columns in sqlite for android

  id (INT)     | owner (VARCHAR) 
 1477            jack
 1578            jill
 :               :
 9277            hill 

1) i like to get a count of the following: - (group by the 1000s range)

RANGE    | COUNT
0-999      0
1000-1999  5
:
8999-9999  7

2) I also like to get a count of the following: - (group by 100s range)

RANGE    | COUNT
X1XX       5
X2XX       6
:
X9XX       7

3) and also group by 10s range.

I'm stuck with how to do the group by

SELECT COUNT(*) FROM myTable 
GROUP BY ??

any pointers is appreciated.

Aucun commentaire:

Enregistrer un commentaire