Helo,
i am attempting to make a select
1st column, currentStatus, has 2 variations: 'Paid', 'Unpaid'
2nd column, payment_id, only gets populated once a payment was done, but there are situations where it does not get a payment_id, those i would like to ignore from the select.
I am trying to select is all the rows that have status Paid and Unpaid, but only select Paid if it has a payment_id, while Unpaid does not have a payment_id to get selected.
SELECT DISTINCT
status
FROM table_name
WHERE
IF(status IN ('Unpaid'), '', paid_id <> '')
This does not return any of the Unpaid rows tho, what am i doing wrong?
Aucun commentaire:
Enregistrer un commentaire