Bagi lansiran menjadi 2 bidang
Alert_count: integer
Alert_period: enum('hour','day','month','week')
Dan ubah kueri seperti ini:
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