Skip to content

Instantly share code, notes, and snippets.

@bcardarella
Created July 22, 2015 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcardarella/106e158c2a7aaa6f65f8 to your computer and use it in GitHub Desktop.
Save bcardarella/106e158c2a7aaa6f65f8 to your computer and use it in GitHub Desktop.
#Ecto.Query<from e in SogApi.Event,
where: fragment("extract(month from ?) = ?", e.start_time, type(^"1", :integer)),
where: fragment("extract(year from ?) = ?", e.start_time, type(^"2015", :integer))>
{"SELECT e0.\"id\", e0.\"title\", e0.\"description\", e0.\"slug\", e0.\"price\", e0.\"total_spots\", e0.\"start_time\", e0.\"end_time\", e0.\"track\", e0.\"status\", e0.\"banner_image\", e0.\"overview\", e0.\"come_prepared\", e0.\"takeaways\", e0.\"teachers\", e0.\"guest
s\", e0.\"inserted_at\", e0.\"updated_at\", e0.\"location_id\", e0.\"category_id\" FROM \"events\" AS e0 WHERE (extract(month from e0.\"start_time\") = $1::integer) AND (extract(year from e0.\"start_time\") = $1::integer)",
[1, 2015]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment