SELECT * FROM payment_log
WHERE Pay_PaymentMethodID IN (5,6,7,8,18,25,28,30)
AND (Third_Party_Field1 IS NULL OR Third_Party_Field1 = '')
AND Pay_Result IN ('CREDIT','DEBIT','CAPTURE')
AND Pay_OrderID IS NOT NULL
AND (Deleted IS NULL OR Deleted != 'Y')
AND Pay_Authdate > '2018-05-01'
AND Pay_Result != 'AUTHORIZE'
AND gateway = 1
ORDER BY pay_authdate