我需要两行的差异
SELECT ( b.l2framessent - a.l2framessent ),
CONVERT((Min(a.datetime) DIV 500)*500, datetime)
+ INTERVAL 5 minute AS endOfInterval
FROM databasename.tablename a,
databasename.tablename b
WHERE a.ipaddress = 'moteid6'
AND b.ipaddress = 'moteid6'
AND a.datetime BETWEEN '2012-09-25 15:45:00' AND '2012-09-25 18:45:00'
GROUP BY a.datetime DIV 500;
这两行都来自同一个表、数据库和同一列
我得到消极和不相关的价值观
如何获得正确的值
select datetime, l2framessent
from 6panview.Statistics3
where ipaddress = 'moteid6'
AND datetime BETWEEN '2012-09-25 15:45:00' AND '2012-09-25 18:50:00';
+---------------------+--------------+
| datetime | l2framessent |
+---------------------+--------------+
| 2012-09-25 17:45:56 | 25 |
| 2012-09-25 17:50:35 | 56 |
| 2012-09-25 17:55:15 | 87 |
| 2012-09-25 17:59:54 | 117 |
| 2012-09-25 18:04:33 | 148 |
| 2012-09-25 18:09:13 | 178 |
| 2012-09-25 18:13:52 | 208 |
| 2012-09-25 18:18:31 | 238 |
| 2012-09-25 18:23:10 | 269 |
| 2012-09-25 18:39:43 | 372 |
| 2012-09-25 18:44:23 | 402 |
| 2012-09-25 18:49:02 | 432 |
+---------------------+-----+