|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
大佬,能看下这个报错吗?sql可以跑,VBA报错了
SELECT IIF(B.航司名称 IS Not NULL,B.航司名称,IIF(C.航司名称 IS Not NULL,C.航司名称,IIF(D.航司名称 IS Not NULL,D.航司名称,IIF(E.航司名称 IS Not NULL,E.航司名称,'南航')))) AS 航司名称,IIF(差异原因mismatch_reason = '对账值不匹配','B表','P表') AS 类型,IIF(资金方向check_type = '收入','国内旗舰店','国内旗舰店') AS 业务线,IIF(核对状态check_status = '未核对','B2C','B2C') AS 票类,SUM(金额amount) AS amount
FROM ((((
SELECT
*
FROM
[Excel 12.0;DATABASE=C:\Users\xiangming.jia\Desktop\疫情自动化-sql\QJD_PAYMENT.xlsx].[Sheet0$] )A
LEFT JOIN (SELECT * FROM [Excel 12.0;DATABASE=C:\Users\xiangming.jia\Desktop\疫情自动化-sql\域名匹配.xlsx].[sheet6$])B
ON A.备注ext_jsonremarkNew = B.MPPM账户)
LEFT JOIN (SELECT * FROM [Excel 12.0;DATABASE=C:\Users\xiangming.jia\Desktop\疫情自动化-sql\域名匹配.xlsx].[sheet6$] )C
ON A.支付公司ext_jsonsubBusinessObject = C.二字码)
LEFT JOIN (SELECT * FROM [Excel 12.0;DATABASE=C:\Users\xiangming.jia\Desktop\疫情自动化-sql\域名匹配.xlsx].[sheet6$] )D
ON LEFT(A.交易流水号trade_no,3) = D.订单号前缀)
LEFT JOIN (SELECT * FROM [Excel 12.0;DATABASE=C:\Users\xiangming.jia\Desktop\疫情自动化-sql\域名匹配.xlsx].[sheet3$] )E
ON LEFT(A.交易流水号trade_no,3) = E.三字代码
GROUP BY 差异原因mismatch_reason,核对状态check_status,资金方向check_type,IIF(B.航司名称 IS Not NULL,B.航司名称,IIF(C.航司名称 IS Not NULL,C.航司名称,IIF(D.航司名称 IS Not NULL,D.航司名称,IIF(E.航司名称 IS Not NULL,E.航司名称,'南航'))))
|
|