Operation Manual

Understanding Databases
Server-side processing
25
516 Crystal Reports User’s Guide
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 clause, the
program sorts the records according to the values in the first field specified, then,
within that sort, the program sorts the records by the values in the second field
specified, and so on. The following SQL statement uses the ORDER BY clause:
SELECT
MYTABLE.‘COMPANY‘,
MYTABLE.‘CITY‘,
MYTABLE.‘STATE‘
FROM
‘MYTABLE‘ MYTABLE
ORDER BY
MYTABLE.‘STATE‘ ASC,
MYTABLE.‘CITY‘ ASC
Note: ASC indicates that the values in the field are sorted in ascending order
rather than descending order (DESC). Ascending order sorts letters from A to
Z and numbers from 0 to 9.
GROUP BY
The GROUP BY clause retrieves a set of summary data. Instead of retrieving
the data itself, GROUP BY groups the data and summarizes each group with
an SQL aggregate function. The server returns only the summarization
information for each group to Crystal Reports.
For example:
SELECT
MYTABLE.‘STATE‘,
MYTABLE.‘ZIPCODE‘,
SUM (MYTABLE.‘SALES‘)
FROM
‘MYTABLE‘ MYTABLE
GROUP BY
MYTABLE.‘STATE‘,
MYTABLE.‘ZIPCODE‘
Server-side processing
Server-side processing allows you to set up a report that performs the majority of
its processing on the server and pushes only relevant details to your computer.
Server-side processing provides you with a number of benefits:
Less time connected to the server.
Less memory needed to process the report on your computer.