Unknown column 's.category' in 'where clause'

SELECT ctx.path, ctx.instanceid, ctx.contextlevel, ra.hidden, r.id AS roleid, r.name as rolename, u.id AS userid, u.firstname, u.lastname FROM mdl_role_assignments ra JOIN mdl_context ctx ON ra.contextid = ctx.id JOIN mdl_user u ON ra.userid = u.id JOIN mdl_role r ON ra.roleid = r.id LEFT OUTER JOIN mdl_course c ON (ctx.instanceid=c.id AND ctx.contextlevel=50) WHERE ( c.id IS NOT NULL OR ra.contextid IN (1,10316,126,7141) )AND ra.roleid IN (3) AND (c.category = 200 OR s.category = 200) ORDER BY r.sortorder ASC, ctx.contextlevel ASC, ra.sortorder ASC
  • line 686 of .php: call to debugging()
  • line 737 of b.php: call to get_recordset_sql()
  • line 1847 of .php: call to get_courses_wmanagers()
  • line 324 of egory.php: call to print_courses()