I’m using the flag module to allow users to flag (like) each other. I would like to display a view that show the matches, i.e. for a given user I would like to display the users he flagged AND that also flagged him. In sql i would use sth. like:
SELECT … FROM {flagging} flagging WHERE flagging.uid = {{uid}} AND flagging.id IN (SELECT flagging.id FROM {flagging} flagging WHERE flagging.entity_id = {{uid}}) AND …
Thus I would use a subquery in the where clause. I don’t think this can be done with a join
How can I achieve this? I thought about using 2 views, one for the subquery and use its results in the second view. But I haven’t found a way to do this.
I also found two hooks hook_views_pre_execute and hook_views_query_alter but I don’t get the difference and I’m not able to use them to add the subquery.