【发布时间】:2016-07-14 09:56:18
【问题描述】:
我尝试编写 Ecto 查询,该查询将同时从两个表中选择数据。像Select t1.*,t2.* from table1 t1,table2 t2 where t1.id=1 and t2.id=2 我找不到解决方案,找到了编写原始 SQL 的唯一方法,看起来不太好。
类似于变体 - 使用预加载,但它会产生额外的查询。
comments_query = from c in Comment, order_by: c.published_at
Repo.all from p in Post, preload: [comments: ^comments_query]
感谢您的任何想法
【问题讨论】: