Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grouping Unioned Subqueries
Message
 
À
02/03/2006 16:32:39
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01101043
Message ID:
01101231
Vues:
8
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform