Duplicate Invoice
Somehow our user managed to get a duplicate invoice added on two different voucher. Our BU duplicate invoice setup is set to reject on vendor and invoice number. I'm trying to find out the extent of this problem so I need a SQL to find if more exist.
My SQL doesn't seem to produce the expected results so can someone please review and let me know what the optimal SQL is?
select * from PS_VOUCHER a
where BUSINESS_UNIT = 'XXX'
AND exists
(select VENDOR_ID, INVOICE_ID
from PS_VOUCHER b
where a.VENDOR_ID = b.VENDOR_ID
and a.INVOICE_ID = b.INVOICE_ID