FIX: Query with Complex Correlated Subquery May Cause Unexpected Results in Aggregate Functions

Article translations Article translations
Article ID: 299285 - View products that this article applies to.
This article was previously published under Q299285
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 352826 (SHILOH_BUGS)
Expand all | Collapse all


Aggregate functions may return incorrect results in a query that has a correlated subquery. The showplan for the query will show a spool operation followed by a nested loop join.


To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack


You can add a merge or hash join hint in the FROM clause of the inner query to remove the spool operation from the query plan. You can also add appropriate indexes so that the optimizer will choose a different query plan that does not use the spool operation.


Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.


Article ID: 299285 - Last Review: January 16, 2015 - Revision: 3.2
  • Microsoft SQL Server 2000 Standard Edition
kbnosurvey kbarchive kbbug kbfix kbsqlserv2000sp1fix KB299285

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from