Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

An aggregate may not appear in the WHERE clause

$
0
0
Hi,Having trouble with this one:[code="sql"] SELECT * FROM [SQLNODEBSTAGE].[PEC_PROD].[DBO].[Staging_Eligibility] WHERE MAX(staging_eligibility_id) <> (SELECT MAX(staging_eligibility_id) FROM [SQLNODEBSTAGE].[STAGING_Archive].[DBO].[Staging_Eligibility_archive])[/code]An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.

Viewing all articles
Browse latest Browse all 3145

Trending Articles