Fetch records between to hours For example records between 5AM to 6PM Sql statement as below
SELECT idProperty
from property_work_hours
WHERE day = '1'
AND (CONCAT('5:00', ' ', 'AM') BETWEEN CONCAT(`working_hour_from`, ' ', `from_period`)
AND CONCAT(`working_hour_to`, ' ', `to_period`)
or CONCAT('6:00', ' ', 'PM') BETWEEN CONCAT(`working_hour_from`, ' ', `from_period`)
AND CONCAT(`working_hour_to`, ' ', `to_period`)) GROUP BY idProperty
Table