我在 MS ACCESS 中有以下语句,它检索 0 个数据并且应该检索 1 个值,因为 qselSumPastDivs_vd 检索到 1 个值:
SELECT tblTrades.Tick,
IIf([tblTrades].[vd_off]>Now(), [qselSumPastDivs_vd].[SumOfBBG_Div_Forecast],
[qselSumOfPastDivs].[SumOfBBG_Div_Forecast]) AS Expr1
FROM ((tblBbgDivData INNER JOIN
tblTrades ON tblBbgDivData.Tick = tblTrades.Tick) INNER JOIN
qselSumOfPastDivs ON tblTrades.Tick = qselSumOfPastDivs.Tick) INNER JOIN
qselSumPastDivs_vd ON tblTrades.Tick = qselSumPastDivs_vd.Tick
GROUP BY tblTrades.Tick,
IIf([tblTrades].[vd_off]>Now(), [qselSumPastDivs_vd].[SumOfBBG_Div_Forecast],
[qselSumOfPastDivs].[SumOfBBG_Div_Forecast]);
是关节产生了问题吗?
我已经删除了 IIF 语句中的 [],但显然,MS ACCESS 需要 () 用于多个 INNER JOIN。还是没有数据...
SELECT tblTrades.Tick, IIf(tblTrades.vd_off>Now(),qselSumPastDivs_vd.SumOfBBG_Div_Forecast,qselSumOfPastDivs.SumOfBBG_Div_Forecast) AS Expr1
FROM ((tblBbgDivData INNER JOIN tblTrades ON tblBbgDivData.Tick = tblTrades.Tick) INNER JOIN qselSumOfPastDivs ON tblTrades.Tick = qselSumOfPastDivs.Tick) INNER JOIN qselSumPastDivs_vd ON tblTrades.Tick = qselSumPastDivs_vd.Tick
GROUP BY tblTrades.Tick, IIf(tblTrades.vd_off>Now(),qselSumPastDivs_vd.SumOfBBG_Div_Forecast,qselSumOfPastDivs.SumOfBBG_Div_Forecast);