Skip to content

Instantly share code, notes, and snippets.

@nadavkav
Created September 17, 2019 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nadavkav/c88cad9a166b23f8f64098ffbf2590c7 to your computer and use it in GitHub Desktop.
Save nadavkav/c88cad9a166b23f8f64098ffbf2590c7 to your computer and use it in GitHub Desktop.
What modules are copied from what course? (PETEL)
SELECT
cm.course, cm.id, cm.module, m.name
,CASE m.name
WHEN 'quiz' THEN (SELECT m.name FROM mdl_quiz m WHERE m.id = cm.instance)
END AS 'Module name'
,t.courseid, c.fullname, u.firstname, u.lastname
FROM mdl_local_courseduplicate t
JOIN mdl_course_modules cm ON cm.id = t.sourceactivityid
JOIN mdl_modules m ON m.id = cm.module
JOIN mdl_course c ON c.id = t.courseid
JOIN mdl_user u ON u.id = t.userid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment