Your closing paren is in the wrong place, it should be immediately after t2.

Also, you should probably repeat the list of columns after GROUP BY in the 
SELECT section of the statement.  Your query  (after fixing the paren) will 
return data, but you won't be able to tell which rows are duplicated because 
you'll see only the serialno column.

--
Larry


________________________________
 From: Bruce Chitiea <[email protected]>
To: RBASE-L Mailing List <[email protected]> 
Sent: Friday, July 6, 2012 12:59 PM
Subject: [RBASE-L] - GROUP BY ... HAVING: Epic Fail
 
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

Reply via email to