我有这个MySQL
查询:
SELECT DISTINCT
*
FROM
students s
LEFT JOIN
(SELECT
*
FROM
studentabsences a1
WHERE
(a1.absence_date = '2013-01-28')) a ON a.absence_student_id = s.student_id
LEFT JOIN
(SELECT
*
FROM
studentabsencenotes b1
WHERE
(b1.absence_note_date = '2013-01-28')
GROUP BY absence_note_student_id) b ON b.absence_note_student_id = s.student_id
INNER JOIN
studentdates sd ON sd.student_id = s.student_id
INNER JOIN
coursecategory ctc ON s.student_course_category_id = ctc.category_id
WHERE
'2013-01-28' BETWEEN sd.student_startdate AND sd.student_enddate
ORDER BY s.student_lastname , s.student_firstname
现在我想添加另一个WHERE
clause
来选择不大于sd.student_break_date
2013-01-28 的行但也选择空字段
例如:
WHERE '2013-01-28' >= sd.student_break_date
这可行,但未列出那些具有NULL
值的行。sd.student_break_date
乱七八糟的吧?我的问题是:如何选择日期不高于 2013-01-28 的空字段和字段