471,052 Members | 1,283 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,052 software developers and data experts.

Get list (count) of records with duplicate field content

I want to get a list of records with duplicate (or triplicate, etc.) fields.
I tried:

SELECT *, count(*) as q FROM test WHERE q > 1 GROUP BY field1;

This didn't work because "q" is regarded as a missing column. Is there a
way to do this in a single SQL statement?

Thanks.

--
Robert Oschler
http://www.dog-images.com -- Devoted to providing free info on the health,
nutrition, and training of dogs.

Jul 20 '05 #1
2 1936

"Robert Oschler" <no_replies@fake_email_address.invalid> wrote in message
news:Vv******************@bignews3.bellsouth.net.. .
I want to get a list of records with duplicate (or triplicate, etc.) fields. I tried:

SELECT *, count(*) as q FROM test WHERE q > 1 GROUP BY field1;

This didn't work because "q" is regarded as a missing column. Is there a
way to do this in a single SQL statement?

Perhaps the following?

select field1,count(field1) from test group by field1 having count(field1) >
1;

Regards,

Mike Chirico
Jul 20 '05 #2
"Mike Chirico" <mc******@comcast.net> wrote in message
news:l5********************@comcast.com...

Perhaps the following?

select field1,count(field1) from test group by field1 having count(field1)

1;

Regards,

Mike Chirico

Mike,

That worked great, thanks!

--
Robert Oschler
http://www.dog-images.com -- Devoted to providing free info on the health,
nutrition, and training of dogs.


Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Nathan Bloom | last post: by
22 posts views Thread by MP | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.