I have a situation in my sql statement. The statement sql I joined the 3 tables together (Application_Detail, Teacher_Detail and Class_Detail), , and what I used WHEREto filter my table, to find out how many teachers use this app, I found the following result.
As you can see in the first entry, both the teacher-related and the class-related fields are null. I am wondering if there is a way to filter the 1st record and show only the 2,3,4 record? because I only want to show the record if there is any value in the teacherId, teacherName, class or grade column.
teacherId teacherName applicationName class grade
1. NULL NULL Excel NULL NULL
2. 5 NULL Excel NULL NULL
3. NULL NULL Excel A 6
4 NULL NULL Excel B 2
Here is my SQL command
SELECT
td.teacherId,
teacherName,
applicationName,
class,
grade
FROM
[AppUser_Detail] as aud
LEFT OUTER JOIN [Teacher_Detail] as td ON aud.teacherId = td.teacherId
LEFT OUTER JOIN [Application_Detail] as ad ON aud.applicationId = ad.applicationId
LEFT OUTER JOIN [Class_Detail] as cd ON aud.classId = cd.classId
WHERE
aud.applicationId = 6 //I filter if my application Id is 6