-
-
Save marzzz21/72620ea8c54c136f2c77909f63d9dad2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT fm.user_id, fm.send_to as number, fma.result, fma.scheduled_start_time, fma.total_fax_duration, (SELECT t.amount from chargeable chrgble left join transactable trnsctble on chrgble.id = trnsctble.id left join transaction_reference tr on trnsctble.id = tr.transaction_item_id left join transaction t on tr.id = t.reference_id WHERE t.credit_bank_id IN (SELECT credit_bank.id from credit_bank left join money_credit_bank on credit_bank.id = money_credit_bank.id where t.credit_bank_id = credit_bank.id) As user_charged FROM fax_message_attempt fma LEFT JOIN fax_message fm on fma.fax_message_id = fm.id WHERE fma.result IS NOT NULL and fm.status = 'DONE' AND fma.scheduled_start_time >= $1 AND fma.scheduled_start_time < $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment