To create a query in a catalog, follow the steps below:
For tables in query of a MongoDB connection, you cannot select all columns by clicking *. The PrimaryKey and ForeignKey columns in each table cannot be selected to a query.
Based on the Auto Join options that are selected in the Query Editor category of the Options dialog, JReport will join the tables automatically. However, if the pre-join feature is enabled for the data source connection where the query is created, the auto join settings will not take effect, instead, JReport applies the pre-joins to the added tables. You can also add more joins among these tables.
When a query has been added to a catalog, you can further edit it to suit your requirements.
Note: Normally, a query returns all the records that match its search criteria without considering whether there are duplicated ones. You can decide to get only one copy for each record by checking Select Distinct on the Query menu. When this option is enabled, SQL SELECT statements are treated as SELECT DISTINCT statements. The query will search for identical records and ensures to return them only once instead of returning duplicate records from the database. However, this feature is only supported on queries built in JDBC connections.