Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grouping Unioned Subqueries
Message
 
To
02/03/2006 16:32:39
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01101043
Message ID:
01101231
Views:
9
Keith,

Thanks for the reply. I think the HAVING is okay. I simplified it incorrectly. Here is the actual GROUP and HAVING clauses:
	GROUP BY
		RetailDate
	,	StoreNo
	,	Category

		HAVING
			SUM(RegUnits) <> 0
		OR	SUM(RegRetail) <> 0
		OR	SUM(RegCost) <> 0

		OR	SUM(ClrUnits) <> 0
		OR	SUM(ClrRetail) <> 0
		OR	SUM(ClrCost) <> 0
I can post (or send directly to you) the entire query if you think it would help.

Chad


>Chad,
>
>I think that the HAVING clause is throwing the query out of whack. It looks like the aggregate functions are missing in the clause. If the clause was changed to the aggregates instead of the source columns, the optimizer would be forced to use the GROUP BY on the outer query.
_________________________________
There are 2 types of people in the world:
    Those who need closure
Previous
Reply
Map
View

Click here to load this message in the networking platform