开发者

SELECT DISTINCT and count

开发者 https://www.devze.com 2023-01-12 04:13 出处:网络
the table looks开发者_StackOverflow like this: tag | entryID ----+--------- foo | 1 foo | 2 bar | 3 And now i want to get all tags with its usage:

the table looks开发者_StackOverflow like this:

tag | entryID
----+---------
foo | 1
foo | 2
bar | 3

And now i want to get all tags with its usage:

foo | 2
bar | 1

How can I do this?

Thank you


select tag, count(*)
from MyTable
group by tag
0

精彩评论

暂无评论...
验证码 换一张
取 消