Skip to content

Instantly share code, notes, and snippets.

@telnicky
Created September 9, 2016 04:30
Show Gist options
  • Save telnicky/e8a64b90ccf6f781e99b97d7455b3e6f to your computer and use it in GitHub Desktop.
Save telnicky/e8a64b90ccf6f781e99b97d7455b3e6f to your computer and use it in GitHub Desktop.
Raw sql query in ecto
query = """
SELECT id, name, inserted_at
FROM users
UNION
SELECT id, name, inserted_at
FROM customers
WHERE name = $1
"""
Ecto.Adapters.SQL.query!(MyApp.Repo, query, ["Carol"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment