user3073987
user3073987

Reputation: 53

Select more than time occurrence in ms sql 2008

I have a table listed like this and i want to find out what are the display names that has repeated on the table, there are so many data that I cannot go manually, and tag names are different even though display names are same.

> tag name  display name
>     3_call    call
>     180_call  call
>     3_pass    pass
>     3_depp    deep

The table has so much data and I want to find out what are the display names has occurred more than one time.

:)

Upvotes: 0

Views: 188

Answers (2)

Nagaraj S
Nagaraj S

Reputation: 13484

Try this

select displayname,count(*)
  from tablename
  group by displayname 
  having count(*) > 1

Upvotes: 2

jdl
jdl

Reputation: 1104

To find out how many times each [display name] appears:

SELECT [display name], COUNT(*)
FROM <Table>
GROUP BY [display name]

To find [display names] that appear more than once:

SELECT [display name], COUNT(*)
FROM <Table>
GROUP BY [display name]
HAVING COUNT(*) > 1

Upvotes: 2

Related Questions