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

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -