我想做一个左连接,但mysql只是做一个内部连接? 我的查询有什么不对?mysql左连接,MySQL做内连接?
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只给那些谁拥有相应提前预约
感谢avHours!
不能使用'='来检查字段是否为空,则必须使用'IS NULL'。 – Matthew