Select 秒最大访问 table
Select second max Access table
以下代码旨在 return 所有项目名称为 table 中所有日期的倒数第二个日期。但是,我不断收到错误消息“您的查询不包含指定的表达式 'Project Name' 作为聚合函数的一部分。我做错了什么?
SELECT DISTINCT TOP 2 Max([Report Date]) AS MaxReportDate
FROM RedProjectHistorical
WHERE (((RedProjectHistorical.[Report Date]) Not In (Select Max([Report Date]) FROM RedProjectHistorical)));
试试更简单的:
SELECT DISTINCT TOP 2
[Report Date] AS MaxReportDate
FROM
RedProjectHistorical
WHERE
[Report Date] Not In
(SELECT Max(T.[Report Date]) FROM RedProjectHistorical As T)
ORDER BY
[Report Date] Desc;
以下代码旨在 return 所有项目名称为 table 中所有日期的倒数第二个日期。但是,我不断收到错误消息“您的查询不包含指定的表达式 'Project Name' 作为聚合函数的一部分。我做错了什么?
SELECT DISTINCT TOP 2 Max([Report Date]) AS MaxReportDate
FROM RedProjectHistorical
WHERE (((RedProjectHistorical.[Report Date]) Not In (Select Max([Report Date]) FROM RedProjectHistorical)));
试试更简单的:
SELECT DISTINCT TOP 2
[Report Date] AS MaxReportDate
FROM
RedProjectHistorical
WHERE
[Report Date] Not In
(SELECT Max(T.[Report Date]) FROM RedProjectHistorical As T)
ORDER BY
[Report Date] Desc;