Add two ranges in a search

Asked

Viewed 13 times

0

I need to create a query that looks for a call according to the time interval.

Example: An employee opens a call in the system, but it will only be shown if it stays open for 2 to 4 hours.

I’m using this code, but I got no result.

SELECT date FROM db WHERE date >= DATE_SUB(NOW(), INTERVAL -2 HOUR) AND DATE_SUB(NOW(),INTERVAL 4 HOUR) AND status='1';
  • I was able to find out: SELECT date FROM db WHERE date <= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND DATE_SUB(NOW(),INTERVAL 4 HOUR) AND status='1';

  • Did you find out, or are you still having the problem? .

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.