不太明白楼主要达到的目的,所以这里所做的两个查询仅供参考,楼主可在此基础上按自己的要求加以修改:
1.
SELECT ra2008.主机卡号, A.交易金额, CDbl(nz([ra2008.交易金额]))/100 AS ra2008表金额, Left(A.交易时间,4) & Mid(A.交易时间,6,2) & Mid(A.交易时间,9,2) AS SHEET表日期, ra2008.交易日期, "交易日期" & IIf(Left(A.交易时间,4) & Mid(A.交易时间,6,2) & Mid(A.交易时间,9,2)=ra2008.交易日期,"","不") & "相等" AS 表达式1, "交易金额" & IIf(A.交易金额=CDbl(nz([ra2008.交易金额])/100),"","不") & "相等" AS 表达式2, ra2008.互代标志
FROM ra2008 LEFT JOIN (SELECT CStr(nz(sheet2.卡号)) AS 卡号_, sheet2.交易金额, Left(sheet2.交易时间,4) & Mid(sheet2.交易时间,6,2) & Mid(sheet2.交易时间,9,2) AS SHEET表日期, sheet2.ID, sheet2.银行代码, sheet2.主帐号, sheet2.交易代码, sheet2.终端编号, sheet2.人行跟踪号, sheet2.交易时间, sheet2.完成情况
FROM sheet2) as
A ON ra2008.主机卡号 = A.卡号_
WHERE (((ra2008.互代标志)="2"));
2
SELECT ra2008.主机卡号, sheet1.交易金额, CDbl([ra2008.交易金额])/100 AS ra2008表金额, Left(sheet1.交易时间,4) & Mid(sheet1.交易时间,6,2) & Mid(sheet1.交易时间,9,2) AS SHEET表日期, ra2008.交易日期, "交易日期" & IIf(Left(sheet1.交易时间,4) & Mid(sheet1.交易时间,6,2) & Mid(sheet1.交易时间,9,2)=ra2008.交易日期,"","不") & "相等" AS 表达式1, "交易金额" & IIf(sheet1.交易金额=CDbl([ra2008.交易金额])/100,"","不") & "相等" AS 表达式2, ra2008.互代标志
FROM ra2008 LEFT JOIN sheet1 ON ra2008.主机卡号 = sheet1.卡号
WHERE (((ra2008.互代标志)="1")); |