如何从一个表中获取所有记录,而不管where子句

时间:2016-02-03 13:09:25

标签: mysql

下面是我的查询,当我放置where子句时,我的记录集减少了。我明白为什么减少, 但是我正在查找teacher_profiles表中的所有记录(31条记录),如果有其他空白则查找相应的详细信息。

任何人都可以提出建议吗?使用mySQL

SELECT
CONCAT(a.teacherFirstName , ' ', COALESCE(a.teacherMiddleName, ''), ' ',  a.teacherLastName ) as teacherName ,
 COALESCE(GROUP_CONCAT(DISTINCT c.subjectLongName SEPARATOR ', ') , '') AS subjects ,
 COALESCE(GROUP_CONCAT(DISTINCT f.classStd SEPARATOR ', ') , '') AS classes ,
FROM
teacher_profiles a  **<--- this table has 31 records. I need all these 31** Record in recordset
LEFT JOIN subjectteacherallocation b ON a.teacherId = b.teacherId 
LEFT JOIN subject_master c ON b.subjectId = c.subjectId
LEFT JOIN timetabledistribution d ON a.teacherId = d.teacherId
LEFT JOIN TimeTableClassSection e ON d.TimeTableClassSectionId = d.TimeTableClassSectionId
LEFT JOIN class_master f ON f.classId = e.classId
WHERE b.academicYear='2015'     <--- condition reducing record
GROUP BY a.teacherId

0 个答案:

没有答案