select a.ypxx_bh,a.ypxx_name,b.yplx_name,c.factory_name,d.yjlx_name from ypxx a left join yplx b on a.ypxx_yplx_id=b.yplx_id left join factory c on a.ypxx_factory_id=c.factory_id left join yjlx d on a.ypxx_yjlx_id=d.yjlx_id
调试欢乐多
from ypxx a
left join yplx b on a.ypxx_yplx_id=b.yplx_id
left join factory c on a.ypxx_factory_id=c.factory_id
left join yjlx d on a.ypxx_yjlx_id=d.yjlx_id
a.ypxx_bh,
a.ypxx_name,
(select yplx_name from 表yplx where yplx_id=a.ypxx_yplx_id) as yplx_name,
(select factory_name from 表factory where factory_id=a.ypxx_factory_id) as factory_name ,
(select yjlx_name from 表yjlx where yjlx_id=a.ypxx_yjlx_id) as yjlx_name
from 表ypxx a