Getting rid of duplicate rows

Last updated on
30 April 2025

The "official" method to list items that are flagged by anybody (and not just by you) is to bring in the flag relationship and choose the "by any user" option.

However, this method leads to duplicate rows because what this does is a JOIN with the flagging table, and the flagging table contains a row for each user who has flagged the item.

One way to solve this problem is to turn on the Distinct option for the view. However, this will solve the problem only if the rows are the same. For example, if you include the "Flags: Flagged time" field, the rows will no longer be the same and Distinct won't squash them.

So, what's the credible way to list flagged items?

Use the counter relationship instead.

In other words, remove the "Node flag" relationship you have in your view (if you have it; or, change its option to "by current user" if you have to have it), and instead add the "Node flag counter" relationship (Make sure the "Include only flagged content" option is ticked). (If it's not "nodes" that you're flagging it's ok: use the corresponding relationship.)

Help improve this page

Page status: Not set

You can: