Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server
To combine conditions with AND, you add the column to the query twice--once for each condition. To combine conditions with OR, you put the first one in the Filter column and additional conditions into an Or... column.
For example, imagine that you want to find either employees who have been with the company for more than five years in lower-level jobs or employees with middle-level jobs regardless of their hire date. This query requires three conditions, two of them linked with AND:
Employees with a hire date earlier than five years ago
ANDwith a job level of 100.-or-
Employees with a job level of 200.
Combine conditions when AND has precedence
In the Criteria Pane, add the data columns you want to search. If you want to search the same column using two or more conditions linked with
AND, you must add the data column name to the grid once for each value you want to search.In the Filter column, enter all the conditions that you want to link with
AND. For example, to link conditions withANDthat search thehire_dateandjob_lvlcolumns, enter the values< '1/1/91'and= 100, respectively, in the Filter column.These grid entries produce the following
WHEREclause in the statement in the SQL Pane:WHERE (hire_date < '01/01/91') AND (job_lvl = 100)In the Or... grid column, enter conditions that you want to link with
OR. For example, to add a condition that searches for another value in thejob_lvlcolumn, enter an additional value in the Or... column, such as= 200.Adding a value in the Or... column adds another condition to the
WHEREclause in the statement in the SQL pane:WHERE (hire_date < '01/01/91') AND (job_lvl = 100) OR (job_lvl = 200)