65.9K
CodeProject is changing. Read more.
Home

COUNT of DISTINCT Rows in SQL Server

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.50/5 (3 votes)

Nov 26, 2010

CPOL
viewsIcon

14510

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