【发布时间】:2016-08-30 03:53:49
【问题描述】:
尝试做这样的事情:
(from f in Foo,
where: f.bar >= ^bar,
order_by: f.cost1 + f.cost2,
limit: 1) |> Repo.one
但它不喜欢通过抱怨无效的表达来进行排序。
也试过这个:
(from f in Foo,
select: %{id: id, total: fragment("cost1 + cost2 as total")},
order_by: f.total,
limit: 1) }> Repo.one
这不是说“f.total”列不存在。
任何想法如何使这个查询工作?
【问题讨论】: