List of Courses and Associated Teachers

List of Courses and Associated Teachers

by Michael Grainger -
Number of replies: 2

Hi can anyone help with the SQL to export a list of all courses along with all teachers associated with those courses please?

I can use configurable reports or ad-hoc queries just don't have the skills required to put this together from scratch.

At the start of next term I would like use this data to produce some lists so that heads of department will be able to see at a glance which teachers need to be added or removed from courses to reflect changes in staffing. I will be using the data to produce a mail merge document with a page per course showing the enrolled teachers. Each page will then become a tick list/comments page so that I can then make sure all courses have been covered before the start of term. Seems a bit old fashioned to do it on paper but it works well and gets the info I need efficiently.


Thanks

Average of ratings: -
In reply to Michael Grainger

Re: List of Courses and Associated Teachers

by Diana G -

Hello... I need the same report for moodle 2.7

Any idea?

In reply to Diana G

Re: List of Courses and Associated Teachers

by Владимир Фулин -

try this

SELECT  concat(pu.lastname," ",pu.firstname) Teacher, 

COUNT(pu.id)

FROM prefix_role_assignments AS ra

JOIN prefix_user AS pu ON ra.userid = pu.id

WHERE ra.roleid=3

GROUP BY pu.id

ORDER BY COUNT(pu.id) DESC