SQLTeam.com | Weblogs | Forums

Need help with this... I'm a noob!


Trying to get a return of Students who have a field marked as "true", but it's not returning anything at all. NEED HELP!

valuefontBold="1" ~[tlist_sql; SELECT (sum(case when suf.mentorship = 'true' THEN 1 ELSE 0)) FROM U_StudentsUserFields suf INNER JOIN students s ON s.dcid=suf.studentsdcid INNER JOIN schools sch ON sch.SCHOOL_NUMBER = s.SCHOOLID INNER JOIN terms t ON t.schoolid=sch.SCHOOL_NUMBER WHERE s.enroll_status > -1 AND t.yearid=~(curyearid) AND t.isyearrec=1 AND s.EntryDate >= t.firstday AND s.exitdate >= t.firstday AND sch.school_number NOT IN (98765,999999) GROUP BY sch.name ORDER BY sch.name] [/tlist_sql]


Does it run correctly at all, or are you getting syntax errors? I see at least one syntax error. You need an END keyword after the ELSE 0

SELECT (sum(case when suf.mentorship = 'true' THEN 1 ELSE 0 END))