我将如何编写使用今天的日期并计算任务状态的 SQL 语句。
我认为这应该返回:
1 = complete task (status = completed)
2 = pending task (in the future and not status=completed)
3 = overdue task (in the past and set to pending)
表 SQL:
CREATE TABLE IF NOT EXISTS `tasks` (
`task_id` int(10) NOT NULL AUTO_INCREMENT,
`task_date` date DEFAULT NULL,
`task_status` enum('pending','approved','complete','cancelled') NOT NULL
PRIMARY KEY (`task_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;