You create a derived table in a Domain by first building a custom query using the objects you selected on the Tables tab. Because Domains are based on JDBC and JNDI data sources, you write the query in SQL. You run the query, and then select columns from the query result for use in the Domain design.
![note-icon-ns_28x28.png.46ff9b9b8a8f52a12253022f87b0e153.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | The clauses in a query determine the structure and content of the table returned by the query. For example, the WHERE clause may contain conditions that determine the rows of the derived table. |
To define a derived table:
| 1. | Type a name for the table in the Query ID field. |
| 2. | Enter a valid SQL query in Query. The query may refer to any table or column in Available objects, as long as their tables are properly joined in the query as well. Only queries that begin with the select statement are allowed. Do not include a closing semi-colon (;). |
![note-icon-ns_28x28.png.aad9fad88b19668d482032c19d367c29.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | Expand the tables in Available objects. Double-click column names to add them to the query. |
| 3. | When the query is complete, click Run Query to test it. |
| 4. | By default, all columns in the result are selected. Ctrl-click to change the selection. If you want only a few columns out of many, it is easier to specify the column names in the SELECT clause of the query. |
| 5. | Click Save Table to add the derived table to Available objects. A distinctive icon ![js-DomainDesigner-icon-DerivedField.png.1d1ca1157c84a03ba35355d4beec816c.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
Recommended Comments
There are no comments to display.