User`s guide

The FROM clause indicates the sources of the database fields specified in the SELECT clause. FROM
lists actual database tables that include the fields and records containing the requested data. The FROM
clause generated by Crystal Reports precedes the name of each table with the alias it uses to identify
the table in your report. The following example illustrates the FROM clause used with the SELECT
clause:
SELECT
TABLEA.'CUSTNAME',
TABLEA.'STATE'
FROM
'TABLEA' TABLEA
23.2.4.4 WHERE
The WHERE clause has two purposes:
To specify record selection criteria.
To show how two database tables are joined.
When WHERE is used to specify record selection criteria, it includes a search condition in order to
determine which records (rows of data) are to be retrieved. For example:
SELECT
MYTABLE.'SALESPERSON',
MYTABLE.'SALESTOTAL'
FROM
'MYTABLE' MYTABLE
WHERE
MYTABLE.'SALESTOTAL' < 10000.00
When WHERE is used to specify how two tables are linked, an SQL join operator sits between the two
table names. See Linking options.
The following is an example of the WHERE clause joining two tables:
SELECT
CUSTOMER.'CUST_ID',
CUSTOMER.'CUST_NAME',
ORDERS.'AMOUNT'
FROM
'CUSTOMER' CUSTOMER,
'ORDERS' ORDERS
WHERE
CUSTOMER.'CUST_ID' = ORDERS.'CUST_ID'
23.2.4.5 ORDER BY
The ORDER BY clause specifies that the database records retrieved be sorted according to the values
in a specific field. If you do not use the ORDER BY clause, the program retrieves records in the order
in which they appear in the original database. If you specify more than one field after the ORDER BY
2012-03-14513
Understanding Databases