| Subject | Re: Select records with duplicate fields | 
|---|---|
| Author | markd_mms | 
| Post date | 2006-05-19T02:36:41Z | 
Hi Helen,
Thanks for your response. What I'm actually after is a list of
actor_id's where the corresponding title_id occurs more than once in
the table. This is actually a sub-query which will eventually be used
to populate a report.
If it were just a matter of selecting the title_id there wouldn't be a
problem...
SELECT title_id
FROM actor_title
GROUP BY 1
HAVING COUNT(*) > 1
but I need to select only actor_id, basically like so (this won't
actually work)
SELECT actor_id
FROM actor_title
GROUP BY title_id
HAVING COUNT(title_id) > 1
Hope that makes things a bit clearer.
TIA
            Thanks for your response. What I'm actually after is a list of
actor_id's where the corresponding title_id occurs more than once in
the table. This is actually a sub-query which will eventually be used
to populate a report.
If it were just a matter of selecting the title_id there wouldn't be a
problem...
SELECT title_id
FROM actor_title
GROUP BY 1
HAVING COUNT(*) > 1
but I need to select only actor_id, basically like so (this won't
actually work)
SELECT actor_id
FROM actor_title
GROUP BY title_id
HAVING COUNT(title_id) > 1
Hope that makes things a bit clearer.
TIA