## Dynamic queries

You can build queries using the Query Editor or from an imported external SQL file. Either way, the queries should be predefined. However, sometimes you may want to specify the query at runtime. For example, in the catalog, you build the query "select customers_id from customers", but at runtime, you may want to fetch data from another table - customers1. The query should be updated according to the table index, such as "select customers_id from customers1". JReport provides a new feature called dynamic query. With this, queries can be dynamically generated, which allow you to fetch data from different tables at runtime.

In this section, you will be shown how to make use of dynamic queries via the dynamic query interface as follows:

- The dynamic query interface
- Using dynamic queries