List Users that are not in a course

List Users that are not in a course

autor Michael B -
Počet odpovědí: 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
Průměr hodnocení: -
V odpovědi na Michael B

Re: List Users that are not in a course

autor 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.