2011-04-21 49 views
0

''嗨,所有 ''查詢正在工作,但我沒有從BD表中獲取數據(B_Detail) ''我在做什麼錯誤..?沒有從第二個表中獲取數據

SELECT CM.CM_Date AS Cdate, CM.C_MemoNo AS CmNo,0 as BookDate, 0 as LR_No, 
CM.CM_Total as CMAmt, 0 as Amt_Rcvd, 0 as ChqDDNo, 0 as ChqDDdate, 0 as Acc_Typ, 
0 as RcptNo,0 as MemoNo, 0 as M_Date, CM.CNee as conName 
from (CMemo as CM 
INNER JOIN ClientLedger ON (ClientLedger.CName = CM.CNee)) 
UNION ALL 
Select 0 as Rcpt_Date, 0 as CmNo, BD.Bdate as BookDate, BD.BNo as LR_No, 
0 as CM_Total, 0 as Amt_Rcvd, 0 as ChqDDNo, 0 as ChqDDdate, 0 as Acc_Typ, 
0 as RcptNo,BD.CST as MNo, BD.GRDate as M_Date, BD.Consignee 
from (B_Detail BD 
INNER JOIN Receipt_CLNT CM ON (CM.CNee = BD.Consignee)) 
UNION ALL 
SELECT Receipt_CLNT.Rcpt_Date, 0 as CmNo, 0 as BookDate, 0 as LR_No, 
0 as CM_Total, Receipt_CLNT.Amt_Rcvd as RcptAmt,Receipt_CLNT.ChqDDNo as RefNo, 
Receipt_CLNT.ChqDDdate as RefDate, Receipt_CLNT.Amt_Mode as Mode, 
Receipt_CLNT.RcptNo as RcptNo, 0 as MemoNo, 0 as MDate, Receipt_CLNT.G_Name 
from Receipt_CLNT 
ORDER BY Cdate; 

回答

0

如果您將問題簡化爲問題部分,它是否仍然不返回數據?

Select 0 as Rcpt_Date, 0 as CmNo, BD.Bdate as BookDate, BD.BNo as LR_No, 
     0 as CM_Total, 0 as Amt_Rcvd, 0 as ChqDDNo, 0 as ChqDDdate, 0 as Acc_Typ, 
     0 as RcptNo,BD.CST as MNo, BD.GRDate as M_Date, BD.Consignee 
from (B_Detail BD 
INNER JOIN Receipt_CLNT CM ON (CM.CNee = BD.Consignee)) 

如果是這樣,則聯接(作爲內部聯接)與任何鍵都不匹配。 CM.CNee = BD.Consignee

+0

謝謝你的回覆,你是對的。它詢問我把參數(CM.CNee)請告訴我如何解決這個問題。 – Marty 2011-04-21 11:31:14

+0

我不確定問題是什麼? – 2011-04-21 19:54:35

+0

我沒有從BD表中獲取數據 – Marty 2011-04-22 09:57:45

相關問題