Sample Header Ad - 728x90

What is the name of this type of query, and what is an efficient example?

3 votes
1 answer
615 views
The purpose is to find a parent, given it's children. For example, say you have a marketing package (aka a "combo"), and want to match it based on the products in it. Example table/data: create table marketing_package_product ( package_id int not null references marketing_package(id), product_id int not null references product(id), primary key (package_id, product_id) ); insert into marketing_package_product values (1,1), (1,2), (1,3), (2,1), (2,5); Given products 1,2,3, I want to get marketing_package 1. But given products 1,2 only I do not want marketing_package 1. Is there a name for this type of query, and what is the most efficient way to go about it?
Asked by Neil McGuigan (8653 rep)
Jul 6, 2013, 06:58 PM
Last activity: Mar 11, 2023, 04:00 PM