Previous Topic Next topic Print topic


Adding Extended Conditions (And and Where)

Some of the conditions on columns that can be added to a query cannot be expressed easily using the Query Conditions Grid. In these cases, you have two alternatives:

An extended search condition is simply another set of conditions that are appended to the Query Conditions Grid as AND conditions.

To define an extended search condition:

  1. Open a new or existing query.
  2. Click the Where (?) button on the toolbar.

    SQLWizard displays the Search Condition dialog box. You compose a series of extended search conditions at the top of this dialog box, one per row.

  3. On the first row, the first drop-down list contains only the NOT qualifier. You should use this if you want to negate the condition you create on this row.
  4. The next field is used to specify the left-hand side of the expression. Move to this field and type in the expression, or compose it using the tools at the bottom of the dialog box. There are drop-down lists containing functions, as well as operators and column names that are used to build the expression.
  5. The next control is a drop-down list containing comparison operators, including SQL predicates such as BETWEEN and IN. Select an operator from this list.
  6. The next field is used to specify the right-hand side of the expression. Move to this field and complete the expression.
  7. The last control on the row is a button to add another condition row to the dialog box. Click it to add another condition row.
  8. Move to the next row and click the down-arrow button on the first drop-down list. While in the first row, the drop-down list only contains the NOT option, in the second and subsequent rows, this list contains connection operators AND and OR, with or without the NOT qualifier. Choose one of the connection operators.
  9. Complete the expression on this row as you did for the previous row.
  10. When you are finished with the extended search condition, click OK to accept the changes.
  11. Examine the Query Conditions Grid. You will see that a new area labeled AND has been added, showing the conditions that you just defined. If you want to make changes to the conditions, double click the area to redisplay the Search Condition dialog box.

If you want to add conditions that cannot be expressed through the Query Conditions Grid columns or the Search Condition dialog box, switch to the SQL view and edit the SQL statement directly. Note that once you have made changes to the statement in the SQL Edit window, you will not be able to switch back to the Query Design window without discarding the changes. Therefore, you should save your query in the Query Design window before switching to the SQL Edit window, and save it from the SQL Edit window using a different name if you make changes.

Previous Topic Next topic Print topic