Possible duplicate, sorry if so. Schema below.
I am trying to select from a many-to-many relationship all edition_ids that have records for, and only for, certain run_id values. I have no idea how to do this outside of a subquery, which I'd rather avoid. Any thoughts? Here's what I have now, which is giving me edition_ids that contain run_id values, but not ONLY those values. SELECT erm.edition_id FROM edition_run_map AS erm WHERE erm.run_id IN ( 2376, 2377, 2378) AND erm.is_active = 1 GROUP BY edition_id; CREATE TABLE `edition_run_map` ( `edition_id` int(11) unsigned NOT NULL, `run_id` int(11) unsigned NOT NULL, `is_active` tinyint(1) NOT NULL default '1', PRIMARY KEY (`edition_id`,`run_id`); Thanks in advance, kabel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]