如何联接表以将表中的值预加载到同一字段中

时间:2019-01-28 13:54:54

标签: elixir ecto

帖子和帖子可以具有附件,附件可以是 图片或文档,帖子中没有引用图片或文档表 我想将图片和文档表中的数据预加载到帖子的附件字段中,该怎么做? 到目前为止,我已经收到以下错误消息:

(ArgumentError) cannot preload attachment as it has been supplied more than once with different queries

我在想这样的事情:

attachment = from(pp in PhotoPost and dp in DocumentPost)

from(p in query,
  preload: [attachment: ^attachment]
)

但这只会给出该错误

0 个答案:

没有答案
相关问题