未从第二个表获取数据

发布于 2024-11-02 13:05:40 字数 1017 浏览 1 评论 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;

''hi all
''query is working but i am not getting data from BD table ( B_Detail )
''What am i doing wrong..??

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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

错爱 2024-11-09 13:05:40

如果将问题简化为仅问题部分,它仍然不返回数据吗?

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.收货人

If you simplify the question to just the problem part does it still not return data?

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))

If so then the join (being an inner join) is not matching any keys.
CM.CNee = BD.Consignee

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文