I need to search a server, through a command, for a 2 hour interval of a saved data in relation to the server time.
Example : An employee opens a call; this call will be saved to the bank on date X with the 12:00:00 time and its status will be "OPEN". I need to fetch all calls that were not resolved within a 2 hour interval.
SELECT datas FROM banco WHERE DATE_SUB(CURDATE(), INTERVAL 2 HOUR) <= datas AND status='2';
The purpose of this command is to search the database for call times and compare with the system time. If it's been two hours, it will show, if not, it will not show.
When I give this command, it shows me this data,
The command was given at 15:03, only he showed other schedules, plus 2 hours open.