今日の日付を使用してタスクのステータスを計算する 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;