How to count rows that have the same values in two columns (SQL)?

前端 未结 7 1918
暗喜
暗喜 2020-12-13 17:53

I am sure there must be a relatively straightforward way to do this, but it is escaping me at the moment. Suppose I have a SQL table like this:

+-----+-----         


        
7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 18:51

    This could be the answer:

    SELECT a, b, COUNT(*) 
    FROM  
    GROUP BY a,b 
    ORDER BY 3 DESC;
    

提交回复
热议问题