SQLite分组
我有一个查询:
select a,count(b) from xyz group by a;
这给出了表中每个不同值“a”的出现次数。我的问题是如何查询相同的值,但现在由另一个字段“c”分组?
例如:
对于人口:
(b;c;a)
1;2;test1
2;4;test1
3;4;test1
4;4;test1
5;3;test2
5;3;test2
我想得到:
(field 'a';number of occurrences for each value of 'c';total of occurrences for 'a')
test1;2;4
test2;1;2
I have a query:
select a,count(b) from xyz group by a;
This gives me the number of occurrences of each different value of 'a' in my table. My question is how can I query the same values but now grouped by another filed 'c'?
Ex:
For population:
(b;c;a)
1;2;test1
2;4;test1
3;4;test1
4;4;test1
5;3;test2
5;3;test2
I'd like to get:
(field 'a';number of occurrences for each value of 'c';total of occurrences for 'a')
test1;2;4
test2;1;2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的意思是“'c'的不同出现次数”,那么请尝试:
If you mean "number of distinct occurerences of 'c'" then try: