Filtering the comparison with a WHERE clause
Published 24 February 2022
You can filter the rows that will be compared by applying a WHERE clause to the comparison. This is useful, for example, if you want to exclude a particular set of test data, or to speed up the comparison.
- You can only filter rows if the data source is a database. WHERE clauses are not available for scripts folders
- The WHERE Clause Editor doesn't validate WHERE clauses. The clauses are validated when the databases are compared.
To specify a WHERE clause for a table:
- When editing a project, on the Tables & Views tab, double click the table you want to filter, or select it and click WHERE Clause... To apply the same WHERE clause to multiple tables, use SHIFT+Click or CTRL+Click to select and highlight multiple tables and then click WHERE Clause...
The WHERE Clause Editor is displayed:
Note: For multiple tables, only the first table will be displayed at the top of the WHERE Clause editor. Also, all tables mush have the same column name in order for the WHERE clause to be valid. Type a valid WHERE clause. For example, if a table has columns ID, FirstName, and LastName, you may want to compare only rows where LastName is Smith. To do this, type the following in the box:
LastName='Smith'
If you want to apply a different WHERE clause for the source and target databases, then clear the Use the same WHERE clause for both data sources check box and type a WHERE clause in the box for the target database.
- Click OK.
- Click Compare Now to run the comparison.