开发者

comparision of two columns within a single table

i have a table开发者_开发知识库 alpha ,this contains two columns A And B. I need to find out how many A's are there for B.

      A             B   
      1     1
      2     2
      3     3
      4     3
      5     4
      6     7


Try grouping :

SELECT `B`, COUNT(*) AS `Count`
FROM `Alpha` 
GROUP BY `B`


try this

SELECT COUNT( * ) AS  `Items` ,  `B` 
FROM  `alpha` 
GROUP BY  `b` 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜