Hello Friends,
I need to get course id in mdl_assign_submission in sql query
This table gets populated when a student submits the assignment
I need to have course id as well.
Get teacher enrolled in a particular course.
CURRENT SQL:
SELECT g.grader, g.timemodified
FROM {assign_grades} g
LEFT JOIN {user} u ON g.grader = u.id
WHERE assignment = $assignmentid AND grader != -1
// I need to get teacher of the enrolled course only and not all the teachers in that project
// g.grader is the teacher who have graded the assignment
QUERY THAT GIVES ALL THE ENROLLED TEACHERS BASED ON COURSE ID
============================================================
SELECT c.id , c.fullname,u.id, u.firstname as tfirstname, u.lastname as tlastname
FROM {course} c
JOIN {context} ct ON c.id = ct.instanceid
JOIN {role_assignments} ra ON ra.contextid = ct.id
JOIN {user} u ON u.id = ra.userid
JOIN {role} r ON r.id = ra.roleid
WHERE r.id = 3 AND c.id = $courseid
Please help me frame the first query based on second one.
Thank you for your help in advance.