我正在尝试获取具有指定“拉”值的最新记录,然后按 imei 号分组。但是我得到了错误的输出,时间与我的数据库中的时间不匹配
这是我的表。
IMEI TIME STATUS
354851057191551 2013-06-25 10:11:30 pull getrestbyimei
354851057191551 2013-06-25 10:10:36 Push getrestbyimei
354851057234971 2013-06-25 10:10:34 Push getbookings
351895053436612 2013-06-25 10:10:32 pull getrestbyimei
351895053436612 2013-06-25 10:10:31 pull getrestbyimei
期望的输出:
IMEI TIME STATUS
354851057191551 2013-06-25 10:11:30 pull getrestbyimei
351895053436612 2013-06-25 10:10:32 pull getrestbyimei
这就是我尝试的方式:
SELECT imei as IMEI, MAX(FROM_UNIXTIME(timestamp)) as TIME, action as STATUS
FROM testlog
where action like 'pull%'
GROUP BY imei
order by TIME asc