我正在尝试在 MS Access 2010 数据库中运行以下查询:
SELECT a.[Level], max(a.dte) AS nextDate, IIf(a.[Type1Date]<a.[Type2Date],"t1","t2") AS Type
FROM (
select [Level], Type1Date as dte, Type1Date, Type2Date
FROM CommunicationTable WHERE ClientNumber=1
UNION
select [Level], Type2Date as dte, Type1Date, Type2Date
FROM CommunicationTable WHERE ClientNumber = 1
) AS a
GROUP BY a.[Level];
但是,Access 给了我一个对话框,说明:
You tried to execute a query that does not include the specified
expression 'IIf(a.[Type1Date]<a.[Type2Date],"t1","t2")' as part
of an aggregate function.
谁能解释这意味着什么并告诉我如何修复代码,以便它返回我请求的字段(级别、下一个日期、类型)?