How can I count unique pairs of values in SQL?

前端 未结 4 913
别那么骄傲
别那么骄傲 2021-01-01 15:58

With the following sql statement I can get all unique values with their counts for a given column:

select column, count(column) as count 
         from table          


        
4条回答
  •  不知归路
    2021-01-01 16:21

    If you just want the count of how many distinct pairs, you could do this more simply. A GROUP BY clause is not necessary.

    SELECT COUNT(DISTINCT first_name, last_name) AS count_names FROM Table
    

提交回复
热议问题