注册 登录
编程论坛 SQL Server论坛

这个是什么意思

袁翠翠 发布于 2022-06-14 13:51, 1598 次点击
SELECT T3.FDATE 生产订单日期,T2.F_BAHSCDDH 生产订单编号,T3.FDATAVALUE 工作令,T3.CPBM 对应产品编码,T3.FNUMBER 物料编码,T3.WLMC 物料名称,T3.FSPECIFICATION 规格型号,
       T3.FQTY 数量,T1.F_BAH_DATE 开工时间,T5.WGRQ 完工时间,T4.FNAME 工序名称 FROM BAH_t_Cust100002 T1
    LEFT JOIN BAH_t_Cust_Entry100046 T2 ON T1.FID=T2.FID
    LEFT JOIN (SELECT T1.FBILLNO,T1.FDATE,T3.FNUMBER,T3.FNAME WLMC,T3.FSPECIFICATION,T4.FNUMBER CPBM,T5.FDATAVALUE,T2.FQTY FROM T_PRD_MO T1
                    LEFT JOIN T_PRD_MOENTRY T2 ON T1.FID=T2.FID
                    LEFT JOIN (SELECT A.FMATERIALID,A.FNUMBER,B.FNAME,B.FSPECIFICATION,A.FBAHTEXTURE FROM T_BD_MATERIAL A
                                    LEFT JOIN T_BD_MATERIAL_L B ON A.FMATERIALID=B.FMATERIALID) T3 ON T2.FMATERIALID=T3.FMATERIALID
                    LEFT JOIN T_BD_MATERIAL T4 ON T2.FBAHSCDDCPMC=T4.FMATERIALID
                    LEFT JOIN (select T1.FENTRYID,T2.FDATAVALUE from T_BAS_ASSISTANTDATAENTRY T1
                                    LEFT JOIN T_BAS_ASSISTANTDATAENTRY_L T2 ON T1.FENTRYID=T2.FENTRYID) T5 ON T2.FBAHWORK=T5.FENTRYID) T3 ON T2.F_BAHSCDDH=T3.FBILLNO
    LEFT JOIN T_ENG_PROCESS_L T4 ON T1.F_BAHGYMC=T4.FID
    LEFT JOIN (SELECT T1.F_BAH_DATE WGRQ,T1.F_BAHGXMC,T2.F_BAHSCDDH FROM BAH_t_Cust100004 T1
                  LEFT JOIN BAH_t_Cust_Entry100049 T2 ON T1.FID=T2.FID
                UNION ALL
               SELECT T1.F_BAH_DATE,T1.F_BAHGYMC,T2.F_BAHSCDDH FROM BAH_t_Cust100003 T1
                  LEFT JOIN BAH_t_Cust_Entry100047 T2 ON T1.FID=T2.FID) T5 ON T1.F_BAHGYMC=T5.F_BAHGXMC AND T2.F_BAHSCDDH=T5.F_BAHSCDDH
5 回复
#2
袁翠翠2022-06-14 13:52
这是金蝶云上面二开的一张代码表,有哪位大神解释一下是什么意思
#3
mywisdom882022-06-15 08:45
只有本站会员才能查看附件,请 登录

一组 LEFT JOIN 对应一个ON,即
LEFT JOIN   ...... ON
带子查询的
一组 LEFT JOIN (.......)对应一个ON,即
LEFT JOIN(......)...... ON



[此贴子已经被作者于2022-6-15 09:13编辑过]

#4
mywisdom882022-06-15 09:25
只有本站会员才能查看附件,请 登录

这个神人,多次使用相同的别名,来混淆阅读;
#5
mywisdom882022-06-15 09:37
故意写混淆的,其实包含多个子查询,最好别名分类,如
select t1.* from XXXX1 t1
left join XXXX2 t2
on t1.xx=t2.yy
left join(select f1.* from XXXX3 f1
          left join XXXX4 f2
          on f1.aa=f2.bb) t3
on t3.cc=t1.bb
大概这样,以后方便其他人阅读         

[此贴子已经被作者于2022-6-15 09:38编辑过]

#6
MayBeDream2022-06-23 16:22
1