Question
IF statement not working when running in a query.
I am trying to create a IF clause and has something like this..
$$
BEGIN
SET calculated_date=(SELECT MAX(timestamp) FROM dataset);
SET current_date= (SELECT now());
IF(TO_DATE(now())>TO_DATE(calculated_date)) THEN
SET calculte_another_date=(SELECT Date_field from a dataset);
IF(TO_DATE(now())= TO_DATE(calculte_another_date)) THEN
DO this
END IF;
END IF;
END
$$