 or coalesce(ip.created_date, 'NULL') != coalesce(bip.created_date, 'NULL')
 or coalesce(ip.account_record_id, 'NULL') != coalesce(bip.account_record_id, 'NULL')
 or coalesce(ip.tenant_record_id, 'NULL') != coalesce(bip.tenant_record_id, 'NULL')
-or bip.invoice_payment_type != 'ATTEMPT'
+or bip.invoice_payment_type != 'ATTEMPT')
+and bip.invoice_payment_record_id !=0
 ;
 
 select 'G2' as sanity_query_name;

left outer join invoice_payments ip on bipc.invoice_payment_id = ip.id
left outer join payments p on ip.payment_id = p.id
where coalesce(p.record_id, 'NULL') != coalesce(bipc.payment_number, 'NULL')
;

select 'H8' as sanity_query_name;

select distinct bipc.account_record_id
from analytics_payment_chargebacks bipc
left outer join invoice_payments ip on ip.id = bipc.invoice_payment_id
where (coalesce(ip.record_id, 'NULL') != coalesce(bipc.invoice_payment_record_id, 'NULL')
or coalesce(ip.ID, 'NULL') != coalesce(bipc.invoice_payment_id, 'NULL')
or coalesce(ip.invoice_id, 'NULL') != coalesce(bipc.invoice_id, 'NULL')
or coalesce(ip.type, 'NULL') != coalesce(bipc.invoice_payment_type, 'NULL')
