Information Technology Questions and Answers Community

I am trying to make query where a user enters a date range to check for events [on hold]

SELECT event.event_name, event.start_date, event.end_date, event.all_year, event.yearly_natural 

FROM event INNER JOIN

     event_location

     ON event_location.event_location_id = event.event_location_id

WHERE (event.yearly_natural = false AND

 

                (event.start_date BETWEEN '$testFrom' AND '$testTo') 

                OR (event.end_date BETWEEN '$testFrom' AND '$testTo') 

                OR (event.start_date <= '$testFrom' AND event.end_date >= '$testTo')

               )    

          OR (event.yearly_natural = true

 

          AND (DATE_FORMAT(event.start_date, '%m%d') BETWEEN '$testFrom' AND '$testTo')

          OR  (DATE_FORMAT(event.end_date, '%m%d') BETWEEN '$testFrom' AND '$testTo')

          OR (DATE_FORMAT(event.start_date, '%m%d') <= '$testFrom' AND event.end_date >= '$testTo')

          )  

 

          OR (event.all_year = true)

PHP         SQL         MySQL        
Your Answer: 

0 Answers
Edit Account
LOGIN INFORMATION
Change Settings
Email Notifications Notifications will be sent to abcd@gmail.com
Select option for your email notifications:
Mature / News Filter We'll send on email when new jobs are posted
Option 2 for email notification We'll send on email when new jobs are posted