User`s guide
A database ranking allows you to specify a ranking at the query and database level so that the data
returned to Crystal Reports by the query is already ranked. This has the following advantages:
• Ranking data can be processing-intensive. By ranking at the database level you allow the server,
which is typically far more powerful than the client machine, to perform this processing.
• Pre-ranking data reduces the amount of data retrieved across the network and stored in Crystal
Reports.
Note:
• You can perform a database ranking only if your database supports it. If this is not the case, the
"Add a top bottom" button is disabled on the Query Panel toolbar. Databases that support ranking
are Oracle, DB2, Teradata and Redbrick.
• Crystal Reports uses the SQL-99 Rank function in ranking SQL.
• SQL is the query language supported by all relational databases (RDBMS), although each database
has its own syntax.
16.6.4 Creating a database ranking
You create a database ranking in the Query Filters pane of the Query Panel.
Note:
You can mix database rankings and other types of query filter in the Query Filters pane.
16.6.4.1 To create a database ranking
1.
Add the objects that you want to appear in your query to the Result Objects pane of the Query Panel.
2.
Select the object that you want to rank by.
3.
Click Add a database ranking on the toolbar.
The ranking outline appears in the Query Filters pane. The object that you selected appears as the
ranking dimension, and the first measure in the query appears as the ranking measure in the "Based
on" list.
Note:
The "Add a database ranking" button is disabled if your database does not support ranking.
4.
Select the ranking direction (Top or Bottom).
5.
Type the number of records you want the ranking to return in the box next to Top/Bottom.
2012-03-14358
Building Queries