SQL Genie Having Tab

Description

The Having tab of the SQL Genie filters the records that your SQL SELECT statement will return when you have a GROUP BY clause.

images/SQR_SQL_Genie_Having_tab.gif

Any time that the Execute Query button (lightning icon) is enabled, you may click it to see a sample of the records that the query will return. At any time you may click the History button to see a list of SQL statements previously created in this session in the SQL History Dialog.

Selecting the Records to Appear in the Report

The HAVING clause of a SQL SELECT statement filters the records that will be returned. A HAVING clause may have multiple parts, each of which evaluates to a logical value, separated by AND or OR keywords. In the example above, only records where CompanyName > 'C' will be returned.

There are 2 methods of generating a HAVING clause.

  • Directly enter it into the SQL text box.

  • Use the genie controls at the top of the dialog to construct the SQL statement.

Using the Genie Controls

  1. To the right of the Field\Expression column click the 'up arrow' button to display the Select Column or Expression dialog.

  2. Create an expression that references one or more columns and click OK.

  3. Select an entry from the Operator list.

  4. Depending on the operator you selected, To the right of the Value\Expression column click the 'up arrow' icon to display the Specify a Value or Expression dialog.

  5. Optionally, place matching parentheses to the left and right sides of the expression.

  6. Optionally, select the Not checkbox to invert the logic of the expression.

  7. Optionally, click the '+' icon to add another part to the HAVING clause.

    images/SQL_Add_Clause_Button.gif
  8. Select "And" or "Or" from the list box at the left side of the second and subsequent parts of a multi-part expression.

  9. Optionally, click the '-' button to remove a part of the HAVING clause.

See Also