SELECT COUNT(DISTINCT ColumnName) FROM dbo.TableNameWhat if you want to count the Distinct combination for multiple Columns? The above syntax will not work. You can use a Derived table to count the distinct combination
Hope this helps!!SELECT COUNT(*) FROM (
SELECT DISTINCT Column1, Column2, Column3 FROM dbo.TableName) AS DistinctTable
No comments:
Post a Comment