Skip to content

Instantly share code, notes, and snippets.

@meotimdihia
Created April 12, 2012 12:24
Show Gist options
  • Save meotimdihia/2366880 to your computer and use it in GitHub Desktop.
Save meotimdihia/2366880 to your computer and use it in GitHub Desktop.
SELECT *
FROM `table`
WHERE `TableID` NOT IN (
SELECT `table`.`TableID`
FROM `table` JOIN `reservation_table`
WHERE `reservation_table`.`TableID` = `table`.`TableID`
&& `reservation_table`.`DateTime` > NOW()
&& `reservation_table`.`DateTime` < ( NOW() + INTERVAL 2 HOUR )
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment