Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query

Author  Topic 

gagani
Posting Yak Master

112 Posts

Posted - 2012-05-24 : 15:26:32
orderid name
100 A
100 B
100 C
101 D
101 E
102 F

I want the list of orderids which has repeated more
than twice.
the output of above should be
100

bitsmed
Aged Yak Warrior

545 Posts

Posted - 2012-05-24 : 15:32:13
[code]
select orderid
from table
group by orderid
having count(*)>2
[/code]
Go to Top of Page
   

- Advertisement -