Error: "Join expression not supported"
Error: "Join expression not supported"
我正在尝试使用 JET 连接查询 Excel 工作簿中的几个命名范围,但收到错误消息(运行-时间错误“-2147217900 (80040e14)”:加入不支持表达式)当我尝试添加第二个条件时,其中一个连接:
Dim strQuery As String
strQuery = "SELECT mrx.Underlying "
strQuery = strQuery & ",mrx.[exp] "
strQuery = strQuery & ",sum(mrx.[codc]) "
strQuery = strQuery & ",max(mapDt.[Str]) "
strQuery = strQuery & "FROM ((([dataMRX] AS mrx "
strQuery = strQuery & "LEFT OUTER JOIN [mapDt] AS mapDt on "
strQuery = strQuery & "(mrx.[exp] = mapDt.[DtNumeric])) "
strQuery = strQuery & "LEFT OUTER JOIN [mapUdl] AS mapUdl on "
strQuery = strQuery & "(mrx.[Underlying] = mapUdl.[rmpUdl])) "
strQuery = strQuery & "LEFT OUTER JOIN [dataTtm] AS ttm on "
strQuery = strQuery & "(ttm.[Underlying] = mapUdl.[ttmUdl] "
strQuery = strQuery & "AND ttm.[End Month] = mapDt.[Dt])) "
strQuery = strQuery & "GROUP BY mrx.Underlying, mrx.[exp] "
strQuery = strQuery & "ORDER BY mrx.Underlying DESC "
具体来说,如果我删除最后一个左外连接 (ttm.[Underlying] = mapUdl.[ttmUdl]
或 tmm.[End Month] = mapDt.[Dt])
中的第一个或第二个连接条件,则查询工作正常。但是,在这两种情况下,我都会收到错误消息。
我正在使用 JET 4.0:
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFile _
& ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"
我不确定这是正确的,但它确实是使用 Jet 引擎执行的。请试一试。
SELECT sub.Underlying ,sub.[exp] ,sum(sub.[codc]) ,max(sub.[Str])
FROM (
SELECT mrx.underlying, mrx.exp, mrx.codc, mapDt.Dt, mapDt.str, mapUdl.ttmUdl
FROM (
[dataMRX] AS mrx
LEFT OUTER JOIN [mapDt] AS mapDt on (mrx.[exp] = mapDt.[DtNumeric])
)
LEFT OUTER JOIN [mapUdl] AS mapUdl on (mrx.[Underlying] = mapUdl.[rmpUdl])
) as sub
LEFT OUTER JOIN [dataTtm] AS ttm on ((ttm.[Underlying] = sub.[ttmUdl]) AND (ttm.[End Month] = sub.[Dt]))
GROUP BY sub.Underlying, sub.[exp]
ORDER BY sub.Underlying DESC
我正在尝试使用 JET 连接查询 Excel 工作簿中的几个命名范围,但收到错误消息(运行-时间错误“-2147217900 (80040e14)”:加入不支持表达式)当我尝试添加第二个条件时,其中一个连接:
Dim strQuery As String
strQuery = "SELECT mrx.Underlying "
strQuery = strQuery & ",mrx.[exp] "
strQuery = strQuery & ",sum(mrx.[codc]) "
strQuery = strQuery & ",max(mapDt.[Str]) "
strQuery = strQuery & "FROM ((([dataMRX] AS mrx "
strQuery = strQuery & "LEFT OUTER JOIN [mapDt] AS mapDt on "
strQuery = strQuery & "(mrx.[exp] = mapDt.[DtNumeric])) "
strQuery = strQuery & "LEFT OUTER JOIN [mapUdl] AS mapUdl on "
strQuery = strQuery & "(mrx.[Underlying] = mapUdl.[rmpUdl])) "
strQuery = strQuery & "LEFT OUTER JOIN [dataTtm] AS ttm on "
strQuery = strQuery & "(ttm.[Underlying] = mapUdl.[ttmUdl] "
strQuery = strQuery & "AND ttm.[End Month] = mapDt.[Dt])) "
strQuery = strQuery & "GROUP BY mrx.Underlying, mrx.[exp] "
strQuery = strQuery & "ORDER BY mrx.Underlying DESC "
具体来说,如果我删除最后一个左外连接 (ttm.[Underlying] = mapUdl.[ttmUdl]
或 tmm.[End Month] = mapDt.[Dt])
中的第一个或第二个连接条件,则查询工作正常。但是,在这两种情况下,我都会收到错误消息。
我正在使用 JET 4.0:
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFile _
& ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"
我不确定这是正确的,但它确实是使用 Jet 引擎执行的。请试一试。
SELECT sub.Underlying ,sub.[exp] ,sum(sub.[codc]) ,max(sub.[Str])
FROM (
SELECT mrx.underlying, mrx.exp, mrx.codc, mapDt.Dt, mapDt.str, mapUdl.ttmUdl
FROM (
[dataMRX] AS mrx
LEFT OUTER JOIN [mapDt] AS mapDt on (mrx.[exp] = mapDt.[DtNumeric])
)
LEFT OUTER JOIN [mapUdl] AS mapUdl on (mrx.[Underlying] = mapUdl.[rmpUdl])
) as sub
LEFT OUTER JOIN [dataTtm] AS ttm on ((ttm.[Underlying] = sub.[ttmUdl]) AND (ttm.[End Month] = sub.[Dt]))
GROUP BY sub.Underlying, sub.[exp]
ORDER BY sub.Underlying DESC