How to create a SQL using 'between' in Elixir Ecto
I don't think Ecto provides a between
clause. You could achieve your task by using
where: t.start_date >= ^start_date,
where: t.start_date <= ^end_date
You can use fragment
to do this.
where: fragment("? BETWEEN ? AND ?", t.date, ^start_date, ^end_date)
https://hexdocs.pm/ecto/3.1.4/Ecto.Query.API.html#fragment/1