0
我想教練和他們的課程的列表:Moodle的教練簡介和他們的課程SQL查詢
我使用下面的查詢
SELECT u.id, u.firstname, u.lastname, u.email, c.fullname
FROM mdl_user u, mdl_role_assignments r, mdl_context cx, mdl_course c
WHERE u.id = r.userid
AND r.contextid = cx.id
AND cx.instanceid = c.id
AND r.roleid =3
AND cx.contextlevel =50
我只得到單過程中,需要在這方面的幫助。下面一個
SELECT u.id, u.firstname, u.lastname, u.email, c.fullname
from mdl_context cx
Left join mdl_course c ON cx.instanceid = c.id
Left join mdl_role_assignments r on r.contextid = cx.id
Left join mdl_user u on u.id = r.userid
WHERE r.roleid =3
AND cx.contextlevel =50
請使用顯式連接。 –