the answer as hint (see how AND is used for multiple join conditions between same table ...last line) SELECT couples.couple_name, couples.pref_location, apartments.id FROM couples JOIN apartments ON apartments.price NOT BETWEEN couples.min_price AND couples.max_price AND location != pref_location /////////////////// btw my answer also worked SELECT c.couple_name,c.pref_location,a.id FROM apartments a join couples c on c.pref_location <> a.location where a.price not between c.min_price and c.max_price
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter