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.
Author |
Topic |
maddyslayer
Yak Posting Veteran
57 Posts |
Posted - 2013-05-03 : 10:43:44
|
Hi,Here's the table, Tid email1 1@1.com2 2@3.com3 1@1.com4 1@1.c0m5 2@3.comHow do i get all the duplicate emails(like I should get 3 records for 1@1.com)? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-03 : 10:50:47
|
[code]SELECT id,emailFROM(SELECT COUNT(1) OVER (PARTITION BY email) AS Occ,*FROM Table)tWHERE Occ > 1[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-05-03 : 10:51:01
|
SELECT email,count(1) from T group by Email having count(1)>1CheersMIK |
|
|
|
|
|