sqlite - Group by regex count -


id 1001 2001 2002 3001 3002 3003 

how group id column first digit 1, 2, 3? mean below:

select count(*) my_tbl group expr_id_1st_digit;  count(*) 1 2 3 

try this:

select count(*)    (select substr(id, 1, 1) mygroup            table1)  group  mygroup  

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -