Microsoft KB Archive/308458

= FIX: Combination of GROUP BY with HAVING Clause and LEFT OUTER JOIN with Derived Table Produces Incorrect Result =

Article ID: 308458

Article Last Modified on 10/16/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Service Pack 3a

-



This article was previously published under Q308458



BUG #: 355244 (SHILOH_BUGS)



SYMPTOMS
If all of the following conditions are true for a query, extra rows may return for certain data sets:


 * You include GROUP BY and HAVING clauses.


 * You use a LEFT OUTER JOIN.


 * You incorporate derived tables.


 * You use an aggregate.



CAUSE
The optimizer inappropriately processes a cross join.



RESOLUTION
To resolve this problem, obtain the latest service pack for Microsoft 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



WORKAROUND
To work around the problem, you can rewrite the query so that not all the conditions listed in the &quot;Symptoms&quot; section are true. For example, you can separate the long query into several simple queries.



STATUS
Microsoft has confirmed that this is a problem in Microsoft SQL Server 2000.

This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.

Additional query words: group by Having Left Outer Join derived tables

Keywords: kbbug kbfix KB308458

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.