I am working on ledger and my php code require query to identify whether its debit amount OR credit amount.
SELECT jobber, IF(Pay_type='Payable', amount AS credit_amount, amount AS debit_amount) FROM Jobber_payments
I have also tried this but not working for me. If there is any possibility in above query.
SELECT jobber, IF(Pay_type='Payable', credit_amount, debit_amount) AS amount_type
amount AS (SELECT amount_type)
FROM Jobber_payments
if condition(Pay_type='Payable') is true, it will pass
credit_amount will be a field name or column name and amount value 5000
else debit_amount will be a field name or column name and amount value 5000
Aucun commentaire:
Enregistrer un commentaire