Results 1 to 2 of 2
Thread: Inner join help please
Mar 17, 2011, 03:07 #1
- Join Date
- Apr 2007
- 0 Post(s)
- 0 Thread(s)
Inner join help please
Wondering if anyone could help me with a inner join query which is confusing me
SELECT photographic_schedule.user_id, photographic_users.name, photographic_schedule.appointment_type, photographic_schedule.live, photographic_schedule.the_date, photographic_schedule.event_begin_time, photographic_schedule.event_end_time FROM photographic_schedule INNER JOIN photographic_users ON photographic_schedule.user_id = photographic_users.user_id WHERE photographic_schedule.appointment_type =98 OR photographic_schedule.appointment_type =99 AND photographic_schedule.live =1 AND photographic_schedule.the_date = '2011-03-17'
Mar 17, 2011, 05:04 #2
When you start using OR and AND in the WHERE conditions, it's better to use parentheses to avoid unwanted results:
WHERE ( photographic_schedule.appointment_type =98 OR photographic_schedule.appointment_type =99 ) AND photographic_schedule.live =1 AND photographic_schedule.the_date = '2011-03-17'
WHERE photographic_schedule.appointment_type IN (98, 99) AND photographic_schedule.live =1 AND photographic_schedule.the_date = '2011-03-17'Guido - Community Team Leader
The Votes Are In: The Winners of the 2013 Community Awards are...
Blog - Free Flash Slideshow Widget