Using Count with Distinct in SQL Server 2008
In this article I describe how to use Count with distinct keyword in SQL
Count is one of the aggregate function in SQL Server 2008 and used to count the number of rows in a database table. Aggregate functions include avg, max, min, count and sum functions. Count can be used with two keyword, one is ALL and another is DISTINCT. Count with DISTINCT keyword is used to return number of unique rows. Count function does not count the null values from the column.
Return number of distinct rows from table
select COUNT(distinct f_Name)as TotalEmployee from Employee