给定查询中的错误是什么

时间:2012-06-08 12:34:47

标签: mysql

执行查询时

SELECT TIMESTAMPDIFF(SECOND, NOW(), 'select lastLoginTime from requests where id = 2 ')

它返回NULL。知道为什么??

1 个答案:

答案 0 :(得分:2)

mysql> SELECT TIMESTAMPDIFF(SECOND, NOW(), 'select last_update from t1 where actor_id = 2 ');
+--------------------------------------------------------------------------------+
| TIMESTAMPDIFF(SECOND, NOW(), 'select last_update from t1 where actor_id = 2 ') |
+--------------------------------------------------------------------------------+
|                                                                           NULL |
+--------------------------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

删除'和add()

mysql> SELECT TIMESTAMPDIFF(SECOND, NOW(), (select last_update from t1 where actor_id = 2));
+-------------------------------------------------------------------------------+
| TIMESTAMPDIFF(SECOND, NOW(), (select last_update from t1 where actor_id = 2)) |
+-------------------------------------------------------------------------------+
|                                                                    -199167725 |
+-------------------------------------------------------------------------------+
1 row in set (0.00 sec)