My Statement looks as follows:
SELECT *,
IF (valid_till = "9999-12-31 23:59:59", NOW(), valid_till) as valid_till,
(valid_till - valid_from) as summary
FROM tablename
So the output of valid till looks correct, but the value of summary is still calculated by the value of "9999-12-31 23:59:59"
How can I achieve that summary is calculated directly by the valid_till value generated by the IF statement?
Thank you
Aucun commentaire:
Enregistrer un commentaire