MySQL条件在最后五分钟

时间:2015-06-02 12:25:37

标签: mysql conditional-statements

这是我到目前为止所得到的:

WHERE (ar.acl_res_name = 'RESSOURCES-GPE-N1-24/7' OR ar.acl_res_name = 'RESSOURCES-GPE-N1-8/20')    
AND YEAR(FROM_UNIXTIME( a.entry_time )) = YEAR(CURDATE())
AND MONTH(FROM_UNIXTIME( a.entry_time )) = MONTH(CURDATE())
AND DAY(FROM_UNIXTIME( a.entry_time )) = DAY(CURDATE())
AND HOUR(from_unixtime( a.entry_time )) = HOUR(CURTIME())
AND MINUTE(from_unixtime( a.entry_time)) = MINUTE(CURTIME() - INTERVAL 5 MINUTE)

我只是想在过去的5分钟工作,这似乎没有做好工作......

1 个答案:

答案 0 :(得分:1)

尝试:

WHERE (ar.acl_res_name = 'RESSOURCES-GPE-N1-24/7' OR ar.acl_res_name = 'RESSOURCES-GPE-N1-8/20')    
AND a.entry_time >= NOW() - INTERVAL 5 MINUTE