MySql IF condition giving Unexpected Results-Collection of common programming errors
I have the following query which i’m cutting short for simplicity
SELECT
@WD:=WORKDAYS(
if(completionDate='0000-00-00 00:00:00',
CURDATE(),
completionDate
),d.recievingdate
) AS workingDays,
@QDays:=IFNULL(QDays,0) as Q,
@RDDays:=IFNULL(RDDays,0) As R,
@onhold:=IFNULL(ONHOLD,0) as OnHold,
@TDAY:=IF((@WD-@RDDays-@QDays)