For running J!5.1 you must https://fabrikar.com/forums/index.php?wiki/update-from-github/ or include the new file manually https://fabrikar.com/forums/index.php?threads/joomla-5-1-and-fabrik-cannot-find-files-error.54473/post-285151 See also Announcements
Please see our announcement here.
select
fv.user_id,
(select ifv.value from jos_community_fields_values as ifv where ifv.field_id = '2' and ifv.user_id = fv.user_id) AS field_2,
(select ifv.value from jos_community_fields_values as ifv where ifv.field_id = '17' and ifv.user_id = fv.user_id) AS field_17
from jos_community_fields as f
left join jos_community_fields_values as fv ON fv.field_id = f.id
group by fv.user_id