Specify a HAVING clause
Specify a GROUP BY clauseSpecify a GROUP BY clauseNo tip for this topicNo example for this topicSpecify an ORDER BY clauseSpecify an ORDER BY clause
You can specify a HAVING clause as one of the following:
An SQL predicate
A logical expression
A compound logical expression
Specifying an SQL predicate  
An SQL predicate is a condition that evaluates to true, false, or unknown.
To specify a HAVING clause that is an SQL predicate:
1. Specify the left operand of the SQL predicate.
2. Select the keyword operator of the SQL predicate.
3. Specify the right operand of the SQL predicate, if any.
a. If the right operand is a value, type the value in the field.
b. If the right operand is a nested SELECT statement:
1. From the Unary operator menu, select Right operand > Nested SELECT, and then the type of nested SELECT statement you want to use.
2. In the Select a query window, specify the nested SELECT statement and select OK.
c. If the SQL predicate has additional operands or keywords, type them in the field.
d. To apply a function or unary operator to the right operand you have specified, from the Unary operator menu, select Right operand and then the function or unary operator you want to apply.
Example:
(EMPLOYEE.STATUS IS NULL)
(EMPLOYEE.NAME LIKE 'JOHN%')
(WAGES.SALARY BETWEEN 2000 AND 3000)
Specifying a logical expression  
A logical expression is mathematical condition that evaluates to true, false, or unknown.
To specify a HAVING clause that is a logical expression:
1. Specify the left operand of the logical expression.
a. To apply a function or unary operator to the left operand you have specified, from the Unary operator menu, select Left operand and then the function or unary operator you want to apply.
2. Select the logical operator of the logical expression.
3. Specify the right operand of the logical expression.
a. If the right operand is a value, type the value in the field.
b. To apply a function or unary operator to the right operand you have specified, from the Unary operator menu, select Right operand and then the function or unary operator you want to apply.
Example:
(EMPLOYEE.NUMBER = WAGES.EMPNUMBER)
(MIN(EMPLOYEE.AGE) > 40)
Specifying a compound logical expression  
A compound logical expression is a logical expression that consists of a combination of expressions, SQL predicates, or other logical expressions.
To specify a HAVING clause that is a compound logical expression:
1. Specify one of the expressions or logical expressions contained in the compound logical expression by following the same steps as for specifying a HAVING clause that is a logical expression.
If you are specifying an expression, select a binary operator instead of a logical operator when following the steps for specifying a HAVING clause that is a logical expression.
2. Select Add to operand lists.
3. Repeat the steps above for each expression or logical expression contained in the compound logical expression.
4. Specify the left operand of the compound logical expression.
a. If the left operand is an expression you specified using the first two steps above, select it from the list.
b. To apply a function or unary operator to the left operand you have specified, from the Unary operator menu, select Left operand and then the function or unary operator you want to apply.
5. Select the logical operator of the compound logical expression.
6. Specify the right operand of the compound logical expression.
a. If the right operand is an expression you specified using the first two steps above, select it from the list.
b. If the right operand is a value, type the value in the field.
c. To apply a function or unary operator to the right operand you have specified, from the Unary operator menu, select Right operand and then the function or unary operator you want to apply.
Example:
(((WAGES.SALARY - WAGES.TAXES) > 3000) AND NOT (EMPLOYEE.AGE < 40))
Specifying an empty expression  
To specify a HAVING clause that is an empty expression:
1. If an operator is specified in the Operator field, select <none> from the list.
2. If an operand is specified in the Left operand field, delete it.
The Expression field should now be empty.
Last modified date: 08/13/2019