>Hi all,
>
>Having trouble with the HAVING clause in this query if SET ENGINEBEHAVIOR 90.
>
>
>
>SELECT ;
> App_ID, MAX(IndexRate) AS IndexRate, MAX(PurchaseDate) AS PurchaseDate, MAX(YEAR(PurchaseDate)) AS Year ;
> FROM AppStreams ;
> WHERE NOT CPIIndexed ;
> GROUP BY App_ID ;
> HAVING IndexRate > 0 ;
> INTO CURSOR IndexedApps
>
>
>
>VFP complains about the HAVING clause. If I revert back to SET ENGINE 70, it's okay. The help notes say that I have to list all the columns except aggregating columns in the HAVING clause.
>
>I thought that "HAVING" was like a "post-grouping" WHERE clause i.e. VFP first does the grouping and then it applies the HAVING to the result of that to yield a subset.
>
>I am not even sure what other column I would put in that HAVING clause.
>
>Albert
HAVING uses aggregate or grouped or constant values, which is not happening in your case.
SELECT ;
App_ID, MAX(IndexRate) AS IndexRate, MAX(PurchaseDate) AS PurchaseDate, MAX(YEAR(PurchaseDate)) AS Year ;
FROM AppStreams ;
WHERE NOT CPIIndexed ;
GROUP BY App_ID ;
HAVING MAX(IndexRate) > 0 ;
INTO CURSOR IndexedApps
----------------------------------
António Tavares Lopes