Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE manager_orders ( type int, time_from datetime, time_to datetime, aptid int, cancelled_at tinyint ); INSERT INTO manager_orders VALUES (1, DATE_SUB(NOW(), INTERVAL 1 DAY), DATE_ADD(NOW(), INTERVAL 1 DAY), 262707, null); SELECT type, time_from, time_to FROM manager_orders WHERE aptid = 262707 AND cancelled_at is null AND (NOW() BETWEEN time_from - INTERVAL 30 Minute AND time_to + INTERVAL 30 Minute OR NOW() BETWEEN time_from - INTERVAL 30 Minute AND time_to + INTERVAL 60 Minute ); SELECT type, time_from, time_to FROM manager_orders WHERE aptid = 262707 AND cancelled_at is null AND ( time_from <= '2021-12-07 16:12:00' + INTERVAL 30 Minute AND time_to >= '2021-12-07 16:12:00' - INTERVAL 60 Minute );

Stuck with a problem? Got Error? Ask AI support!

Copy Clear