select * from table1 a inner join table2 b left join table3 c on b.id = c.id where a.id = b.id