Here is the query:
SELECT `mainevents`.`maineventid` AS `MainEventID`,
`mainevents`.`maineventcode` AS `MainEventCode`,
`mainevents`.`datestart` AS `DateStart`,
`mainevents`.`dateend` AS `DateEnd`,
`mainevents`.`location` AS `Location`,
`mainevents`.`name` AS `Name`
FROM `mainevents`,
`mainevents_lookup`
WHERE `mainevents`.`maineventid` = `mainevents_lookup`.`maineventid`
AND `mainevents`.`categoryid` = 1
AND ( ( `mainevents_lookup`.`datestart` >= '2016-02-27 00:00:00'
AND `mainevents_lookup`.`datestart` <= '2016-05-27 11:59:59' )
OR ( `mainevents_lookup`.`dateend` >= '2016-02-27 00:00:00'
AND `mainevents_lookup`.`dateend` <= '2016-05-27 11:59:59' )
OR ( `mainevents_lookup`.`dateend` <= '2016-05-27 11:59:59'
AND `mainevents_lookup`.`datestart` >= '2016-02-27 00:00:00'
) )
LIMIT 0, 30
It is trying to find the listings that have dates that fall within the selected two date ranges. DateStart is '2016-02-27 00:00:00' and DateEnd is '2016-05-27 11:59:59'
For some reason it keeps giving me the opposite results of what I want to find. I know the answer is right in front of me, anyone can give me a hand?