我一定遗漏了一些明显的东西,但为什么会出现以下情况
SELECT c.ContractID, max( cs.ContractStatusCreated)
FROM dbo.NMPT_Contract AS c INNER JOIN
dbo.NMPT_ContractStatus AS cs ON c.ContractID = cs.ContractID INNER JOIN
dbo.CMSS_Status AS s ON cs.StatusID = s.StatusID
group by c.ContractID
having cs.ContractStatusCreated = MAX(cs.ContractStatusCreated)
从 SQL Server 2000 返回以下内容?
消息 8121,级别 16,状态 1,行 1 列 'cs.ContractStatusCreated' 在 HAVING 子句中无效,因为它既不包含在聚合函数或 GROUP BY 子句中。
不是MAX
聚合函数吗?