使用BIGINT值的MySQL查询中的否定结果

时间:2015-02-19 20:19:21

标签: mysql sql

我正在使用MySQL进行以下查询:

SELECT id, from_unixtime(`timestamp`/1000, '%Y-%m-%d') as day_time, timestamp, end_timestamp, min((`end_timestamp`-`timestamp`)/60000) as min_diff_minutes from table1 WHERE imp<=130;

表格如下(此表只是原始表格的一小部分):

+--------------+------------+---------------+---------------+
|      id      |    day     |   timestamp   | end_timestamp |
+--------------+------------+---------------+---------------+
| 71fce85098b9 | 2014-03-09 | 1394367994962 | 1394368030106 |
| 81fgr85093y6 | 2014-03-09 | 1394367950493 | 1394367993432 |
| 12rtw63423d1 | 2014-02-15 | 1394367302837 | 1394367783463 |
| 77grs82544e7 | 2014-01-21 | 1394367003472 | 1394367903843 |
+--------------+------------+---------------+---------------+

查询结果如下:

+--------------+------------+---------------+---------------+------------------+
|      id      |    day     |   timestamp   | end_timestamp | min_diff_minutes |
+--------------+------------+---------------+---------------+------------------+
| 71fce85098b9 | 2014-03-09 | 1394367994962 | 1394368030106 | -23359195.5028   |
+--------------+------------+---------------+---------------+------------------+

怎么可能有

  

-23359195.5028

MIN()函数的结果,因为值&#34; min_diff_minutes &#34;只是&#34; end_timestamp &#34;的差异。使用&#34; 时间戳&#34;分为60000?

PS无论如何,值&#34; 时间戳&#34;和&#34; end_timestamp &#34;属于 BIGINT 类型。

0 个答案:

没有答案