更新时间:2023-10-06 13:29:46
在MS Access中,CASE/WHEN
的***翻译是嵌套的
In MS Access, the best translation of CASE/WHEN
would be the nested IIF() function. Also in update SQL statements with Access' dialect, you would not use the FROM
clause at end.
唯一的挑战是跟踪应该等于IIF数量的括号.我在下面缩进以帮助可视化:
The only challenge is keeping track of parentheses which should equal the number of IIFs. I indent below to help visualize:
UPDATE [HRBI Query]
SET [HRBI Query].[PaySegmentMultiplier] =
IIF([PayGroupCountryDesc] = 'Country' AND BasePayRangeSegment = 'Above top segment', 0,
IIF([PayGroupCountryDesc] = 'Country' AND BasePayRangeSegment = 'Below segment 1', 1.35,
IIF([PayGroupCountryDesc] = 'Country' AND BasePayRangeSegment = 'S1', 1.25,
IIF([PayGroupCountryDesc] = 'Country' AND BasePayRangeSegment = 'S2', 1.15,
IIF([PayGroupCountryDesc] = 'Country' AND BasePayRangeSegment = 'S3', .90,
IIF([PayGroupCountryDesc] = 'Country' AND BasePayRangeSegment = 'S4', .60,
IIF([PayGroupCountryDesc] = 'Country' AND BasePayRangeSegment = 'S5', .40,
PaySegmentMultiplier
)
)
)
)
)
)
);