How to: Specify Search Conditions

You can specify the data rows that appear in your query by specifying search conditions. For example, if you are querying an employee table, you can specify that you want to find only the employees who work in a particular region.

You specify search conditions using an expression. Most commonly the expression consists of an operator and a search value. For example, to find employees in a particular sales region, you might specify the following search criterion for the region column:

='UK'

Note

If you are working with multiple tables, the Query and View Designer examines each search condition to determine whether the comparison you are making results in a join. If so, the Query and View Designer automatically converts the search condition into a join. For more information, see How to: Join Tables Automatically.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To specify search conditions

  1. If you have not done so already, add the columns or expressions that you want to use within your search condition to the Criteria pane.

    If you are creating a Select query and do not want the search columns or expressions to appear in the query output, clear the Output column for each search column or expression to remove them as output columns.

  2. Locate the row containing the data column or expression to search, and then in the Filter column, enter a search condition.

    Note

    If you do not enter an operator, the Query and View Designer automatically inserts the equality operator "=".

The Query and View Designer updates the SQL statement in the SQL pane by adding or modifying the WHERE clause.

See Also

Concepts

Rules for Entering Search Values

Expressions in Queries

Other Resources

Specifying Search Criteria