I needed to create a list with the total count of flags, for a specific flag type, made by users. The query to do this for one user is this:SELECT COUNT(*) FROM flagging WHERE uid=[user_id] AND fid=[flag_id];
Doing this with views, while not very difficult is a bit trivial. You need to start with a node view and not with a user view. From here on things go as follows:
- Add a relationship: Flags Content Flag and set it to the flag type you want. Make sure to check 'by any user'. Do net check 'include only flagged content'.
- Then add a relationship: Flags User and set its relationship to be the one from the first step. Check 'require this relationship'.
- Enable aggregation from the advanced settings
- Add a field in the view: User Name (aggregation type: group results together)
- Add a field: Content Title, with aggregation set to COUNT.
- Display the results in a table or filter them any way you want, you view is ready.
Image