More About Filters

The custom filters option on the Customer List and the Reservation List is based on SQL. SQL is a standard computer language for accessing and manipulating databases. It allows you to select records based on criteria.

 

What follows is a brief introduction to SQL using the customer list as an example, and how the underlying SQL applies to the custom filters. It is hoped that this discussion will enable you to more fully utilize custom filters.

SQL Basics

A typical SQL statement looks like the following:

 

SELECT fieldname

FROM tablename

WHERE fieldname columnoperator condition

 

For example,

 

SELECT state

FROM customerlist

WHERE State="TX"

 

returns a list of all customers who live in the state of Texas.

 

With the WHERE clause, the following operators can be used:

 

Equal

Not equal

Greater than

Less than

Greater than or equal

Less than or equal

BETWEEN an inclusive range, such as a date range.

LIKE Search for a pattern, such as all names containing the letter A

 

To add more than one criterion, you use AND or OR. AND and OR join two or more conditions in a WHERE clause. The AND operator displays a record if ALL conditions listed are true. The OR operator displays a record if ANY of the conditions listed are true.

 

For example,

 

SELECT state

FROM customerlist

WHERE State='TX'

AND LastName LIKE 'A'

 

Returns records for customers that live in Texas AND have last names beginning with A.

 

SELECT state

FROM customerlist

WHERE State='TX'

OR LastName LIKE 'A'

 

Returns records for customers that live in Texas OR have last names beginning with A.

 

Applying SQL to the Custom Filter

 

The following is a the portion of the customer list with the custom filter boxes active.

 

FormMoreFilters.gif

 

The left side drop-down list corresponds to SELECT

The middle drop-down list corresponds to the WHERE operator

The right side box corresponds to the WHERE clause condition

AND/OR radio buttons join where clauses

 

Note: You do not have to select the FROM database. RezOvation GT will select the appropriate database for you - either customers or reservations.

 

Thus the above filter translates to

 

SELECT state

FROM customerlist

WHERE State='TX'

OR LastName LIKE 'A'

 

and returns records for customers that live in Texas OR have last names beginning with A.