I trying to write Ecto query which will be select data from two tables at the same time. Like Select t1.*,t2.* from table1 t1,table2 t2 where t1.id=1 and t2.id=2
I can't find solution, found only way to write raw SQL and it's looks like not good.
Like variant -using preload, but it's spawn additional query.
comments_query = from c in Comment, order_by: c.published_at
Repo.all from p in Post, preload: [comments: ^comments_query]
Thanks for any ideas
Try this from Ecto.Query
https://hexdocs.pm/ecto/Ecto.Query.html#join/5