List Users that are not in a course

List Users that are not in a course

par Michael B,
Nombre de réponses : 2
Good morning,

is there a way to list all users that are not in a course? I don't think this can be done from the admin gui but rather would be an SQL statement. Am I correct with that?

Would appreciate it someone could maybe write the SQL statement as I'm not realy up2date with the moodle db and what I would have to join to get the correct answer.

Thanks for your time,

Michael
Moyenne des évaluations  -
En réponse à Michael B

Re: List Users that are not in a course

par Helson C,

$DB->get_records_sql('SELECT * FROM {user} u WHERE u.id NOT IN (SELECT userid FROM {useR_enrolments}))


You can try it.

Remember to remove admin or other user that you don't need, like admin, guest.


Cheers.