How do I insert two table in one from?

The example is like this

def choose() do
from(u in User1, u2 in User2) ← got error
|> where([u, u2], ==
|> Repo.all()


In sql it works like this

SELECT * FROM User1, User2
WHERE User1.ID = User2.ID

Why can’t I use 2 table in one from like sql?
Is there anything wrong?

Try this instead:

query = from u in User1,
join: u2 in User2,
on: ==


This might work, joining the two?

1 Like

Thanks! I’ll try it!

def list_not_chosen_users(user) do
    from(u in User)
    |> join(:left, [u], u2 in User2, on: !=
    |> where([u2],is_nill( <- It occurs error
    |> Repo.all()

How do I put is_nill in that area? There are only answers about no pipelines.

Oh… my bad… it was a typo.

Did it work?