SQL help to only show users in the report output who share the same group as the current user

SQL help to only show users in the report output who share the same group as the current user

by Com Pharm -
Number of replies: 0

All our users are added into groups for every course they're enrolled in - these are separate groups and so any user in Group A will only have access to see other users in Group A, and will not be able to see any users in any other group.

Therefore, any configurable reports that are run by a user MUST only show users within their group(s). 

Is anyone able to help by providing some vague SQL code to achieve this?

Average of ratings: -