mysql时差查询

时间:2012-12-20 11:58:53

标签: mysql sql database

我有一个查询,我必须以分钟计算时差,但我也需要秒。那么,我可以在以下查询中使用6.10说明6分10秒吗?或者有没有其他的陈述?

查询:

select distinct(users) , avisitedDate from visitSearchEngine vs
WHERE vs.users!=' ' 
AND vs.status='0' 
AND vs.hitType='googleIdentified'
AND vs.avisitedDate>'2012-12-06' 
AND ((TIME_TO_SEC(TIMEDIFF(NOW(),vs.avisitedDate)))/60)>=5
AND ((TIME_TO_SEC(TIMEDIFF(NOW(),vs.avisitedDate)))/60)<6.10

请给我建议!

谢谢,

1 个答案:

答案 0 :(得分:1)

select distinct(users) , avisitedDate from visitSearchEngine vs
WHERE vs.users!=' ' 
AND vs.status='0' 
AND vs.hitType='googleIdentified'
AND vs.avisitedDate>'2012-12-06' 
AND TIMEDIFF(NOW(),vs.avisitedDate) >= '00:05:00'
AND TIMEDIFF(NOW(),vs.avisitedDate) < '00:06:10'