Splits de waarschuwing in 2 velden
Alert_count: integer
Alert_period: enum('hour','day','month','week')
En verander de zoekopdracht als volgt:
SELECT *
FROM `activities`
WHERE CASE alert_period
WHEN 'hour' THEN date_sub(`deadline`, INTERVAL alert_count HOUR) >= CURDATE();
WHEN 'day' THEN date_sub(`deadline`, INTERVAL alert_count DAY) >= CURDATE();
...
END CASE