I am trying to join two tables, but the issue is that as a condition i need their field “time” to be approximately the same.
Let me write a little clearer, this is what i thought to do up to now.
SELECT location
FROM retailer
LEFT JOIN imovo
ON retailer.time=imovo.time.
Now, what i really need is not this : retailer.time=imovo.time but i need that the difference between the seconds of the field in retailer table to be not larger than 4 seconds to the imovo time field.
Let me explain, let’s suppose the time field from retailer says: 11:11:23 i should join this two tables if the time from imovo is between : 11:11:23 and 11:11:26
So, could you please help me on this one?
Thanks!
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_addtime
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_subtime