2
做時使用簡單的數學NOW()...MySQL的NOW()列不正確的時間值 - 錯誤代碼1292
mysql>
select cdrstatuschangets from cdrs where (cdrstatuschangets < now() - 10);
+---------------------+
| cdrstatuschangets |
+---------------------+
| 2009-09-25 13:55:50 |
+---------------------+
1 row in set (0.00 sec)
show warnings;
Empty set (0.00 sec)
經常的工作,但有時,...
mysql>
select cdrstatuschangets from cdrs where (cdrstatuschangets < now() - 50);
+---------------------+
| cdrstatuschangets |
+---------------------+
| 2009-09-25 13:55:50 |
+---------------------+
1 row in set, 1 warning (0.00 sec)
show warnings;
+---------+------+-----------------------------------------------------------------------+
| Level | Code | Message | |
+---------+------+-----------------------------------------------------------------------+
| Warning | 1292 | Incorrect datetime value: '20090925211564.000000' for column 'cdrStatusChangeTS' at row 1 |
+---------+------+-----------------------------------------------------------------------+
1 row in set (0.00 sec)
,有時儘管預期會出現選擇結果。
好的,可能會這樣做,但我的問題是「簡單的數學」機制的不可靠性。如果它沒有實際用途,或者不能被依賴,那麼它確實應該被當作語法錯誤或其他東西拒絕。 – Straff 2009-10-12 03:26:18
@Straff:完全同意。 – 2009-10-12 08:58:44