Hi there, I am new to Moodle and inexperienced in SQL.
I found this SQL which works fine, instead, I would like to change the 'city' column to a custom user profile which I have created called: jobtitle.
_______________________________________________________
SELECT
user2.firstname AS Firstname,
user2.lastname AS Lastname,
user2.email AS Email,
user2.city AS City,
course.fullname AS Course
,(SELECT shortname FROM prefix_role WHERE id=en.roleid) AS ROLE
,(SELECT name FROM prefix_role WHERE id=en.roleid) AS RoleName
FROM prefix_course AS course
JOIN prefix_enrol AS en ON en.courseid = course.id
JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id
JOIN prefix_user AS user2 ON ue.userid = user2.id
_____________________________________________________________________________
I have tried to change the line:
user2.city AS City,
to:
user2.profile_field_jobtitle AS Jobtitle
But that didn't work.
Thank you very much for your help.