I have a table with subscription values and want to calculate the time when the subscription expires.
I use the following statement:
SELECT contractType, paymentReceivedOn FROM payments WHERE id=21
AND IF (contractType = 'abo3', ADDDATE(paymentReceivedOn, 'INTERVAL 3 MONTH') AS expiryDate, 0)
My above statement works if I leave out the AS expiryDate part, however, then I cannot seem to get the result from the caculation of ADDDATE out.
How can I adjust my query so that it gives me the expiryDate based on paymentReceivedOn + 3 months?