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 |
|
Johnyalm
Starting Member
49 Posts |
Posted - 2004-10-27 : 13:39:51
|
| I have a table with registered users. Some people are nasty enough to register twice or more.Now I would like to selct only those rows that has the same e-mail in the field email.So if there are 2 rows with the address double@double.com I would like the SELECT to get them for me...Anybody who can help me with this SELECT?www.mirrorgate.com |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-27 : 13:43:12
|
| SELECT Email, COUNT(*)FROM Table1GROUP BY EmailHAVING COUNT(*) > 1 --or = 2 if you don't care about 3 or more registrationsTara |
 |
|
|
Johnyalm
Starting Member
49 Posts |
Posted - 2004-10-27 : 13:46:09
|
| THANKS!It took 3 minutes and 21 seconds to get the answer!You are all great!www.mirrorgate.com |
 |
|
|
VIG
Yak Posting Veteran
86 Posts |
Posted - 2004-10-27 : 13:46:19
|
| select * from MyTable tjoin (select email from MyTable group by email having count(*) >1) t1on t.email=t1.email |
 |
|
|
|
|
|