0
I need to search on a server, through a command, an interval of 2 hours of a saved data relative to the server time.
Example: An employee opens a call; this call will be saved to the bank on date X with time 12:00:00 and its status will be "OPEN". I need to pick up all the calls that haven’t been solved in a 2-hour window.
SELECT datas FROM banco WHERE DATE_SUB(CURDATE(), INTERVAL 2 HOUR) <= datas AND status='2';
The purpose of this command is to search the bank for the time of the calls and compare with the system time. If it’s been two hours, it’ll show, if not, it doesn’t show.
When I give this command, it shows me this data,
The command was given at 15:03, only it showed other times, beyond 2 hours open.