Dips > Data Processing > Query Data

# Query Example 4

This example demonstrates the use of the OR operator, to search for multiple entries in a single column.

TYPE == fault || TYPE == shear

1. Select Query Data from the toolbar or the Analysis menu.

2. Create the Expression TYPE == fault.

3. Select the Expression button.

4. Select the OR button.

5. Create the Expression TYPE == shear.

6. Select the Expression button.

7. Select OK.

For the example.dip file, this query should create a new file with 9 rows.

- Note that all entries in the TYPE column are either "fault" OR "shear".

***************IMPORTANT NOTE!!!!!*********************

This illustrates the following important point about querying for multiple entries in a single column – you MUST use the OR operator between Expressions, and NOT the AND operator. It is a common mistake to attempt to use the AND operator for this purpose. However, a logical AND in this type of query will not find any matches in the file, since a given cell in the grid cannot be equal to (==) two different strings at the same time. So always remember to use the OR operator when querying for multiple entries in a single column.

*****************************************************

This form of query can be extended to any number of Expressions, for example:

TYPE == fault || TYPE == shear || TYPE == qtzvein || TYPE == bedding

will find all fault, shear, qtzvein and bedding entries in the TYPE column. If you only wish to EXCLUDE a single entry, it can be more easily done with the NOT EQUALS (!=) operator, for example:

TYPE != joint

will produce the same results as the above four expression query, for the example.dip file.