先用 distinct 去重让连接表和主表形成一对一的数据关系。

select a.a1,a.a2,a.a3,b.b1,b,b2 from tableA a left join (select distinct b1,b2 from tableB) b on b.b1= a.a2