当前位置:数据库 > SQLServer >>

SQL SERVER 2005问题,如何连接四个表,按照第一个表左连接,下面是语句,帮我看看哪儿错了

selectD.Fdate AS '订单日期', D.FCustID AS '购货单位', D.FBillNo AS '单据编号', D.Fauxqty AS '数量', F.FAuxQty AS '发货数量', XC.Fauxqty AS '出库数量', D.FDeptID AS '部门', D.FEmpID AS '业务员', D.FItemID AS '产品名称', D.Fmodel AS '产品规格', D.FunitID AS '单位' from (select * from (select * from (select * from (select * from vwICBill_32 d left join SEOrder dr on d.finterid=dr.finterid ) left join SEOutStockEntry fr on d.finterid=Fr.FSourceInterID ) left join vwICBill_34 f on f.finterid=fr.finterid ) left join vwICBill_8 xc on xc.FSourceBillNo=f.FBillNo )
答案:这样应该就可以了

selectD.Fdate AS '订单日期',
D.FCustID AS '购货单位',
D.FBillNo AS '单据编号',
D.Fauxqty AS '数量',
F.FAuxQty AS '发货数量',
XC.Fauxqty AS '出库数量',
D.FDeptID AS '部门',
D.FEmpID AS '业务员',
D.FItemID AS '产品名称',
D.Fmodel AS '产品规格',
D.FunitID AS '单位'
from vwICBill_32 d
left join SEOrder dr on d.finterid=dr.finterid 

left join SEOutStockEntry fr on d.finterid=Fr.FSourceInterID 

left join vwICBill_34 f on f.finterid=fr.finterid 

left join vwICBill_8 xc on xc.FSourceBillNo=f.FBillNo

上一个:SQL Server 服务管理器下载,就是图片上面的这个东西,应该在哪里下载
下一个:sql server 存储过程,问题补充里的这句什么意思?

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,