I have this query, and i need to find the difference between two time format.
So i need to add a clause, which would be:
WHERE end-date - start-date should be between 01:00:00 and 05:00:00
Could you help me with turning it to a mysql statement?
Thanks
$data = mysql_query( "select r.`time`, r.`epos_id`,r.`basket_value`, r.`date`,re.`location`,i.`user_id`,i.`mobile_number`,
i.`time`, i.`rbpos_id`, i.`date`
from retailer r
join rbpos_epos re on r.epos_id = re.epos_id
join imovo i on i.rbpos_id = re.rbpos_id
WHERE TIMEDIFF(i.`time`, r.`time`)<'01:05:00'
and r.`time` < i.`time`
and r.`date` = i.`date`;
")
You can use TIMEDIFF mysql function