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
 Select records based on number

Author  Topic 

gemispence
Yak Posting Veteran

71 Posts

Posted - 2006-03-08 : 10:08:30
I'm trying to select records that occur more than once. I'm trying to base this on the email column. So basically I want the query to look something like this:

select * from table where emailaddress count > 1

Can someone provide me with the correct syntax? :)

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-08 : 10:11:33
Something like

Select column from yourTable group by column having count(*)>1

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-03-08 : 10:14:27
[code]
select *
from Email E
join (select emailaddress from Email group by emailaddress having count(emailaddress ) > 1) t1 on t1.emailaddress = E.emailaddress
[/code]


Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -