OK, I think that did it.
Here is the MySQL query in its full working glory;
SELECT DISTINCT
`test_event`.`name`,
`test_event`.`id`
FROM
`test_event`
Left Join `test_eventbook` ON `test_event`.`id` = `test_eventbook`.`eventId`
WHERE NOT
(
(`test_eventbook`.`bookStart` <= '2008-05-03...
I think I might have simplified the query down to this;
SELECT `test_eventbook`.`eventId`
FROM
`test_eventbook`
WHERE NOT
(
(`test_eventbook`.`bookStart` <= '2008-05-03 00:00:00' AND `test_eventbook`.`bookEnd` >= '2008-05-05 23:59:59')
AND
(`test_eventbook`.`bookStart` <= '2008-05-04...
I think I got it, but I'm not 100% sure. Could someone check and see if there is a better way to do this;
Note: for test purposes I wanted to find all event (id's) that were available in the selected range 04/05/08 to 06/05/08 with a 2 day flexibility;
SELECT DISTINCT...
Hi guys,
I'm having a bit of trouble finding querying a table with "start" and "end" dates.
Consider the following tables;
Event table
------------
id | eventName
1 Event 1
2 Event 2
Event Bookings Table
---------------------
id | eventId | bookingStartDate | bookingEndDate |
1...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.