select a.id , (select b.name1 from 表b b where b.pid1 = a.pid1) name1,(select b.name2 from 表b b where b.pid2 = a.pid2) name2,(select b.name3 from 表b b where b.pid3 = a.pid3) name3 from 表a a
select a.id,p1.name1,p2.name2,p3.name3 from 表a as a,表b as b1,表b as b2,表b as b3 where
a.pid1=b1.pid1 and
a.pid2=b2.pid2
a.pid3=b3.pid3