Skip to content

Instantly share code, notes, and snippets.

@mreigen
Created February 16, 2021 05:36
Show Gist options
  • Save mreigen/3e9bbc652f3d772ef4c7c7ce7064ecd7 to your computer and use it in GitHub Desktop.
Save mreigen/3e9bbc652f3d772ef4c7c7ce7064ecd7 to your computer and use it in GitHub Desktop.
import Ecto.Query
...
from(store in Store,
where: fragment("NOT EXISTS (SELECT * FROM APPLIANCES item WHERE item.store_id == ? AND item.name == 'VCR player')", store.id),
where: fragment("NOT EXISTS (SELECT * FROM GAME_CONSOLES item WHERE item.store_id == ? AND item.name == 'Sega Genesis console')", store.id),
where: fragment("NOT EXISTS (SELECT * FROM DELIVERY_TRUCKS truck WHERE truck.store_id == ?)", store.id)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment