Problem with query to extract bank statement lines details and related transactions
Hello, I've got a query to extract the reconciled and unreconciled bank statement lines + all the transactions related to reconciled lines (i.e., receivables, journals). The query works fine but every time there is reconciliation group M:M (both from our M:M matching rule or from manual reconciliation) the lines are duplicated. See example attached: only the green lines are correct while the other should not be in the extraction at all.
Please find below the query. What can be done to improve this? Thank you very much for the support!
select
TO_CHAR(h.STMT_FROM_DATE, 'dd/MM/yyyy') statement_date_from_H,
0