我有一个表格alpha,它包含两个A和B列。我需要找出B有多少A。
A B
1 1
2 2
3 3
4 3
5 4
6 7
答案 0 :(得分:1)
尝试分组:
SELECT `B`, COUNT(*) AS `Count`
FROM `Alpha`
GROUP BY `B`
答案 1 :(得分:1)
试试这个
SELECT COUNT( * ) AS `Items` , `B`
FROM `alpha`
GROUP BY `b`