SELECT DISTINCT ShoppingCartItems.cartid from ShoppingCartItems inner join Items on ShoppingCartItems.itemid=Items.itemid where Items.name='Teddies'; - collects results - SELECT DISTINCT ShoppingCartItems.cartid from ShoppingCartItems inner join Items on ShoppingCartItems.itemid=Items.itemid where Items.name='Trampolines'; - collects results - SELECT DISTINCT ShoppingCartItems.cartid from ShoppingCartItems inner join Items on ShoppingCartItems.itemid=Items.itemid where Items.name NOT IN ('Teddies','Trampolines'); - collects results, calculates the intersection from first two and then the difference of the intersection and the third query - SELECT ShoppingCart.name_on_cart from ShoppingCart where ShoppingCart.cartid=2;