News

Copyright © 2008-2018 Paula DiTallo

Tag Cloud



SQL Server: How can I get a distinct count(*) with multiple columns?

To get a count(*) of distinct column combinations, do the count(*) over the distinct select statement.

Example:

SELECT count(*)
  FROM (SELECT DISTINCT
          ColumnA,
  ColumnB,
  ColumnC
              FROM YourTable 
             ) x
Wednesday, August 9, 2017 12:45 PM

Feedback

No comments posted yet.


Post A Comment
Title:
Name:
Email:
Comment:
Verification: