Finding Duplicates in a Table 's Column

3:36 AM
I assume You have Northwind Database.

I will be using The Employee Table.


As Show in the figure there are 6 Selected cells which are the Duplicates( Just assume it)
I want to find this number ( i mean 6.)

The query for the above is:

SELECT  Title
      , COUNT(Title) AS NumOccurrences
FROM    dbo.Employees
GROUP BY Title
HAVING  ( COUNT(Title) > 1 )

SELECT  *
FROM    dbo.Employees

0 comments:

Post a Comment