enrolments and role assignments are completely separate (you can have a role in a course without being enrolled in it). In normal use, this distiction is transparent. But it's the role_assignment table you want. You also need to understand Moodle's contexts. This is where the fun starts.
Re: Help with querying the Moodle database: getting user role in each course
by Howard Miller -
Number of replies: 0