-
Count of specific records
I'm having problems constructing a query. I need to get a count of emails in my database, but only the emails that appear 2 or more times.
Can anyone help?
Thanks!
Justine
-
Try
select count(email) total from Table group by email having count(email) > 1
-
Thanks so much! It worked beautifully!
-Justine
-
what is your approach to this script if you need to include a where line to limit the range in which you are evaluating the table for duplicates. Lets say, using the example that started the thread, I want to gather duplicates for e-mails, but only for those rows where the State field = 'MI'
How would that work with this script?
-
Never mind...I answered my own question...
select * from EmpAddresses where email in (select email from EmpAddresses group by email having count(email) > 1)
and state = 'MI'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|