我的数据库中有一个时间字段,它的值为 22:05
我想减去 5 分钟。当该字段为 datetime 时,我使用 sub_date 并且工作正常,但我无法使用 time 字段获取它,我收到一个我不知道如何处理的警告;
mysql> SELECT scheduleFinalTime FROM clientSchedule WHERE clientScheduleID = 3;
+-------------------+
| scheduleFinalTime |
+-------------------+
| 22:05:00 |
+-------------------+
1 row in set (0.00 sec)
mysql> SELECT date_sub(scheduleFinalTime, INTERVAL 5 MINUTE) FROM clientSchedule WHERE clientScheduleID = 3;
+------------------------------------------------+
| date_sub(scheduleFinalTime, INTERVAL 5 MINUTE) |
+------------------------------------------------+
| NULL |
+------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+------------------------------------------------------------+
| Level | Code | Message |
+---------+------+------------------------------------------------------------+
| Warning | 1264 | Out of range value for column 'scheduleFinalTime' at row 1 |
+---------+------+------------------------------------------------------------+
1 row in set (0.00 sec)
先感谢您