>  A pointer to the appropriate syntax for retrieving the entire row when
> count(loc_name, sample_date, param) > 1 would be much appreciated.
> 
> Rich
> 

Select * 
From table
Natural Inner join (
SELECT loc_name, sample_date, param, Count(*) as duplicate_count
FROM table
Group by loc_name, sample_date, param
) grouped
Where duplicate_count > 1
;

You first group and count on the candidate key and then effectively self-joint 
that result back onto the original table.  natural join is short-hand for cases 
where the two joining table use the same name for semantically identical field. 
 Much easier than saying "t1.field1 = t2.field1 AND t1.field2 = t2.field2 AND 
etc..."

David J.
-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to