How can I do a count distinct in sqlite?

后端 未结 2 690
清歌不尽
清歌不尽 2020-12-08 18:09

I have a table:

ref,type
1,red
2,red
3,green
4,blue
5,black
6,black

I want the result of a sqlite query to be:

red,2
green,         


        
2条回答
  •  一向
    一向 (楼主)
    2020-12-08 19:06

    A quick google gave me this: http://www.mail-archive.com/sqlite-users@sqlite.org/msg38339.html

    select type, count(type) from table group by type;
    

提交回复
热议问题