I want to do a left join but mysql just does an inner join?
whats wrong with my query?
select av.*, ap.*
from tbl_available av
left join tbl_appointment ap
on av.avHours = ap.appointmenttime
where av.avCalendarId = 2
and (ap.calendarid = 2 or ap.calendarid= null)
and (ap.appointmentdate = "2012-10-01" or ap.appointmentdate = null)
and av.avDays = DayOfweek("2012-10-01")
order by avHours
mysql only gives those avHours who have a corresponding appointment
Thanks in advance!
Because of these conditions:
you only select rows from
tbl_appointmentwhich are notnull.If that’s what you want – move them to the left join’s
ONpart