没有从第二个表中获取数据

时间:2011-04-21 10:46:56

标签: sql ms-access

''大家好 ''查询正在运行,但我没有从数据库表中获取数据(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;

1 个答案:

答案 0 :(得分: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