Convert LEFT JOIN SQL query to Ecto query

Hi all,

I have a simple query but I don’t know how should I convert it to ecto query?

SELECT, anklets.model, FROM 
anklets LEFT JOIN customers ON = customers.anklet_id 

Would you please help me to implement currect Ecto query?

I found the solution:

query = from a in Anklet, 
        left_join: c in Customer, 
        on: == c.anklet_id, 
        select: {, a.serial_num,}, 
        where: is_nil

Hi @alishir, give it a shot with something like this:

from(a in "anklets"
  left_join: c in "customers",
  on: == c.anklet_id,
  where: is_nil(,
  select: {, a.model,}
1 Like

Thanks for your guidance.

1 Like