Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Probs with HAVING clause
Message
De
20/12/2017 14:08:42
 
 
À
16/12/2017 13:17:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012 R2
Network:
Windows Server 2012 R2
Database:
Visual FoxPro
Application:
Desktop
Virtual environment:
VMWare
Divers
Thread ID:
01656466
Message ID:
01656599
Vues:
81
that fixed it. I was under the impression from the error message that I had to have something in there for each aggregated column (I think the error msg was either misleading or too generic). Reading some other posts elsewhere, it seems that the HAVING clause perhaps only works on an aggregated column. Here was a good summary:

"WHERE clause introduces a condition on individual rows; HAVING clause introduces a condition on aggregations, i.e. results of selection where a single result, such as count, average, min, max, or sum, has been produced from multiple rows. Your query calls for a second kind of condition (i.e. a condition on an aggregation) hence HAVING works correctly.

As a rule of thumb, use WHERE before GROUP BY and HAVING after GROUP BY. It is a rather primitive rule, but it is useful in more than 90% of the cases."

source: https://stackoverflow.com/questions/9253244/sql-having-vs-where

Thanks for the suggestion.
Albert

>What happens if you change "AS IndexRate" to AS "cIndexRate" -- thus eliminating any confusion as to the reference in the HAVING clause?
>
>Hank
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform