Your question is not very clear, but I seems that you want to retrieve just certain custom profile fields. Is that correct?
But where are you trying to display those custom profile fields? Are you trying to display them in a plugin, or do you just want to retrieve the data via SQL?
Anyway, try this if you want to retrieve the data via SQL:
SELECT
mdl_user.id AS student_id,
mdl_user.firstname + ' ' + mdl_user.lastname AS student_name,
mdl_user_info_field.id AS profile_field_id,
mdl_user_info_field.name AS profile_field_name,
mdl_user_info_data.data AS profile_field_value
FROM mdl_user
INNER JOIN mdl_user_info_data ON mdl_user.id = mdl_user_info_data.userid
INNER JOIN mdl_user_info_field ON mdl_user_info_data.fieldid = mdl_user_info_field.id
WHERE (mdl_user.deleted = 0)
AND (mdl_user_info_field.id = 2)
That will give you something like:
student_id student_name profile_field_id profile_field_name profile_field_value
1231 Michelle Slabbert 2 HR ID 127803
1232 Melisha Sampoda 2 HR ID 132803
1233 Mark Clif Smit 2 HR ID 118875
The key is that if you use mdl_user_info_field.id = 2 it will give you the data in the SECOND custom profile field for all active users. Whatever id you specify in mdl_user_info_field.id determines which custom profile field will be returned. If you want the third custom profile field change it to: mdl_user_info_field.id = 3, or 1 for the first custom profile field, etc.