Your group by clause will select all the rows, Bruce.
Try this to get only those rows with duplicated serial numbers.

SELECT SerialNo, Attrib1, Attrib2, AttribN +
FROM table +
WHERE SerialNo IN +
(SELECT SerialNo from table group by serialno having count(*) > 1)




On 06/07/2012 10:59 AM, Bruce Chitiea wrote:
Ok, I'm stumped. My generic code structure, the last of many I've tried:

SELECT serialno +
FROM table +
WHERE serialno IN +
(SELECT DISTINCT serialno +
FROM table t2 +
GROUP BY serialno,attrib1,attrib2,...,attribN +
HAVING COUNT(*) > 1)


I'm cleaning up all the sin and normalizing from a legacy flat-file
database with several hundred thousand rows involving maybe 15,000
unique 'serialno' values.

I need to make a list of serialno values where for each listed serialno
there exist rows encompassing more than one unique set of
[serialno,attrib1,attrib2,...,attribN] values.

No matter what I try, I end up with a list of ALL 15,000 distinct
serialno values.

Help!

Bruce





-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2195 / Virus Database: 2437/5114 - Release Date: 07/06/12





Reply via email to