Duplicate data rows in the result set can often be excluded by checking the 'Return Distinct Records' box on the Fields screen in QueryPlus, but this technique must not be treated as a 'magic bullet'. Here is an example of how legitimate data can be excluded by mistake.
In a query looking for Invoice Transaction Premium, with the Return Distinct Records box checked, we notice this row:
If we un-check Return Distinct Records, we get this:
So there are actually THREE Invoice Transactions on the same Policy, on the same day.
Adding Invoice Number to our query, we see that there were actually 3 different INVOICES for the same Policy on the same day, hence the 3 transactions.
In this case, adding Invoice Number to our query, even when Return Distinct Records is checked, makes each of these 3 rows 'distinct', or unique (because they each have a different Invoice Number, the field on the right), so they all appear on the output.
In a very rare case, it is possible for a single Invoice to have multiple Transactions with the same Premium - this apparently can happen when Invoice Commissions are being adjusted within an Invoice, rather than by cutting a new Invoice. For these cases, there is a field available to differentiate between otherwise identical Invoice Transactions in a single Invoice: Invoice Transaction ID.
Since 'Return Distinct Records' is often necessary in a query for other reasons
Don't be put off by the seeming complexity of the number (this is the AMS360 version, AfW just gives you a date/time), it's just what Microsoft calls a GUID - Guaranteed Unique ID. It is only in the query to make each Invoice Transaction unique.
This problem is not limited to Invoices and Invoice Transactions. It can occur in any query that uses Return Distinct Records, if the data in two or more rows looks identical to QueryPlus.
The best defense against this type of problem is to carefully examine your output against Policy records in the AMS interface. If discrepancies appear, investigate them with an eye on duplicated (or missing) records.