Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / SQL

COUNT of DISTINCT Rows in SQL Server

3.50/5 (3 votes)
26 Nov 2010CPOL 14.5K  
Nice tip :)But if you have any column say empid which have the unique constraint then it is better to use the following SQL queryselect count(distinct empid ) from employees

Nice tip :)


But if you have any column say empid which have the unique constraint then it is better to use the following SQL query


select count(distinct empid ) from employees

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)