This is a rather complex issue, but the simple answer lies in the hierarchical nature of relationship database structure. An example:
For each Policy, there may be many Transactions. The Policy data is stored in the Policy table, with one row for a policy. Transaction data is stored in the Policy Transaction table, with one row for each Transaction.
That means that if we query a Policy Number (from the Policy table) and Transaction amounts (from the Transaction table), the Policy Number will be duplicated:
Notice that the Policy Number shows up on each line, because each of the premium Transactions belongs to that Policy.
It is important to note that this is not a peculiarity of QueryPlus, but is inherent in relational database queries.
It is also easy to see that for most types of data – Policy Number, Customer Name, Addresses, etc. – this duplication does not cause a problem.
This problem does occur when numerical values from different ‘levels’ are put into the same query. Here is an example from the Invoice, Invoice Transaction and Invoice Commission tables:
In this case, there is only one Transaction for this Invoice ($1281), but because there are 3 records in the Invoice Commission table for that one Transaction, the Transaction Gross Amount is duplicated on all 3 lines.
The practical effect is that when this dataset is sent to the report designer (or Excel, Access, etc) and the amounts are summed, the Invoice Transaction Gross Amount will show up as $3,843, which is wrong.
OK, that’s the problem, what’s the solution? There are several:
1. Just being aware of this issue will make a big difference. Select fields and examine the resulting datasets with an eye towards making sure that numerical data isn’t being duplicated.
2. Make use of QueryPlus’s built-in summed data fields. For instance, in the Invoice example above, QueryPlus provides fields from the Invoice Commission table that are already summed up to the Invoice Transaction level:

Comparing this result with the one above for the same Invoice, we can see that each field is only shown once, so the data will show up properly on a report.
3. If you can’t find a field at the right level, just ask! Here at QualCorp, we are always working on new fields and database connectivity, and most of them start as ideas brought to us by you, the QueryPlus user community.
So don’t hesitate to ask – we’re happy to work with you to create new fields, queries and report, because once it works for you, we can put it on the Knowledge Base and make it available to ALL QueryPlus users.