08
Sep

Drupal 7 - Remove Duplicate Views Results

08 Sep

When you are building a Drupal site and creating views, it's not uncommon to find that your view is showing the same result multiple times.

Here are two ways to remove duplicate views results.

Option 1: Distinct

This is how Views describes the Distinct option:

"If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it does not always work."

  • Open the Advanced area.
  • Next to "Query settings", click "Settings".

 
  • Check the boxes, "Distinct" and "Pure Distinct".
 

 

Option 2: Aggregation

Aggregration is often used to perform calculations on field data. For example, you can use Aggregation to count the number of content items in a particular content type. Or you could use it count the average number of comments on your content.

However, if the Distinct option doesn't work, we can use also try to use aggregation to remove duplicate items.

  • Open the Advanced area.
  • Next to "Use aggregation", click "No".

 
  • Check the "Aggregate" box.


Option 3: Views Aggregator Plus

It is a more complex module which allows users to add more functionality to the aggregration.
 
  • Open Format Settings and choose "Table with Aggregation".
  • Open Settings and choose Group aggregation or Column aggregation.




Enjoy!


 
Leave A Comment