johnnyb
09-01-2004, 09:19 PM
Hi,
I have 2 tables, 'ballet' and 'ballet_creator' ballet creator is really a reference table for a 3-way relationship but for the moment I don't need to join beyond these two tables.
So I have this join:
"SELECT ballet.*, ballet_creator.* FROM ballet INNER JOIN ballet_creator ON ballet.BALLET_ID=ballet_creator.BALLET_ID WHERE ballet_creator.PROFESSION_ID=2";
and it's working fine. The problem is I have multiple records in 'ballet_creator' with the same BALLET_ID. This is true for some, but not all, BALLET_ID's. When I complete the join I want my result set to include only one row for the ballets that have two records in 'ballet_creator'. I hope I've been clear enough on what I want.
Also, if it helps, in the 'ballet_creator' table when there are multiple records with the same BALLET_ID there is a true/false field in which the one primary record marked true.
If someone knows how to do this that would be great. I've been pounding my head against a wall for several hours now and am running out of ideas.
John
I have 2 tables, 'ballet' and 'ballet_creator' ballet creator is really a reference table for a 3-way relationship but for the moment I don't need to join beyond these two tables.
So I have this join:
"SELECT ballet.*, ballet_creator.* FROM ballet INNER JOIN ballet_creator ON ballet.BALLET_ID=ballet_creator.BALLET_ID WHERE ballet_creator.PROFESSION_ID=2";
and it's working fine. The problem is I have multiple records in 'ballet_creator' with the same BALLET_ID. This is true for some, but not all, BALLET_ID's. When I complete the join I want my result set to include only one row for the ballets that have two records in 'ballet_creator'. I hope I've been clear enough on what I want.
Also, if it helps, in the 'ballet_creator' table when there are multiple records with the same BALLET_ID there is a true/false field in which the one primary record marked true.
If someone knows how to do this that would be great. I've been pounding my head against a wall for several hours now and am running out of ideas.
John