一个关于left outer join的问题
以下是系统中的两个视图联合起来查询:
SELECT TOP (100) PERCENT t1.Fdate, t1.FCheckFlag, t1.FHookFlag, t1.FCostID, t1.FTrade, t1.FBillNo, t1.FDeptIDt1, t1.FEmpIDt1, t1.FCurrencyID,
t1.FRSCBillInterIDt, t1.Fmodel, t1.Fauxqty, t1.Fauxprice, t2.Fauxprice AS FCostPrice, t1.F_Amount - t1.FTaxAmount AS FTaxAmount,
t1.Fauxqty * t2.Fauxprice AS FCostamount, (t1.F_Amount - t1.FTaxAmount) - t1.Fauxqty * t2.Fauxprice AS FProfit, t1.FSourceBillNo, t1.FOrderBillNo,
t2.FOrderEntryID
FROM AIS20110927142957.dbo.vwICBill_43 AS t1 LEFT OUTER JOIN
AIS20110927142957.dbo.vwICBill_8 AS t2 ON t2.FbillNo = t1.FSourceBillNo AND t2.Fmodel = t1.Fmodel AND t2.FOrderBillNo = t1.FSourceBillNo AND
t2.FOrderEntryID = t1.ForderEntryID
结果出来的数据,只要是t2视图中的数据就出不来,不知道怎么回事?确定都有数据。
------解决方案--------------------那就是某个条件导致的,你逐个屏蔽试试
------解决方案--------------------连接条件定位不准确,lz检查一下on后面的条件是否OK