Operation Manual
Building Queries
Viewing the SQL behind a query
18
Crystal Reports User’s Guide 355
Viewing the SQL behind a query
When you build a query, Crystal Reports automatically generates the SQL
that corresponds to the query and saves it as a Crystal SQL Command
object. For more information about SQL Command objects, search for
“Defining an SQL Command” in the Crystal Reports Online Help.
u
To view the SQL when you create a query
• In the Query Panel, click View SQL.
The SQL dialog box appears; it contains the SQL that constitutes your query.
Use this option when you want to check the SQL as you create a query.
u
To view the SQL after you have created a query
• In Crystal Reports, open a report created with a universe as a data
source, go to the Database menu, and click Show SQL Query.
You can see the SQL in the Show SQL Query dialog box.
Or
In Crystal Reports, open a report created with a universe as a data
source, go to the Database menu, and click Database Expert.
Once you are in the Database Expert, right-click your query in the
Selected Tables list and select View Command. You can see the SQL in
the View Command dialog box.
Query filters and prompts
Creating query filters
You can use the following types of filters in a query:
• Predefined filters
These filters are created by your administrator.
• Custom filters
You define these filters while you are creating the query.
• Advanced filters
You define these filters on sub-selections of the data in your query.
• Prompts
Prompts are dynamic filters that you define to display a question or a list
of values; users can select different filter value(s) each time they refresh
the report.