Monday, October 12, 2015

Querying Oracle to get students that do not have parent accounts in PowerSchool

You can use this SQL query to get all the students that do not have parent account linked to them in PowerSchool:


SELECT s.LASTFIRST, s.STUDENT_NUMBER, s.FAMILY_IDENT, s.FATHER,                                           u.SSIS_FATHER_EMAIL, s.MOTHER, u.SSIS_MOTHER_EMAIL
FROM students s INNER JOIN u_studentsuserfields u ON s.DCID = u.STUDENTSDCID
WHERE s.DCID not in (SELECT g.STUDENTSDCID FROM guardianstudent g)
       AND s.ENROLL_STATUS = 0;