HAVING句は、出力レコードをフィルタリングするときに使用します。
HAVING <BooleanExpression>
RETURN Reps AS SELECT SUM(Amount) AS SalesTotal FROM SaleState GROUP BY SalesRep HAVING SalesTotal > 10000
// Invalid because "Price" is not defined in the statement (i.e., Price is a collection attribute). Return results AS SELECT SUM(Price) AS TotalPrices FROM SaleState GROUP BY WineType HAVING Price > 100
In statement "results": In HAVING clause: Local statement attribute "Price" is not in scope
// Valid because "TotalPrices" is defined in the statement. Return results AS SELECT SUM(Price) AS TotalPrices FROM SaleState GROUP BY WineType HAVING TotalPrices > 100