Sam
Sam

Reputation: 111

Duplicate items appearing in view? - Drupal 7

I've created a view block but when I run, duplicates are showing.

A snapshot of the view looks can be seen at:

view snapshot

You can see the duplicates in action at:

block demo

Any idea how I can prevent this from happening (the duplicate items both link to the same node/page)?

I've enabled aggregation, then looked into aggregation settings for my Content: Title FIELD.

However there doesn't seem to be a unique type option under aggregation type?

The options are: - Group results together - Count - Count DISTINCT - SUM - Average - Minimum - Maximum - Standard deviation

I have tried enabling Distinct and Pure Distinct. Neither seem to work.

Upvotes: 1

Views: 1364

Answers (2)

Sam
Sam

Reputation: 111

Here's how I found a solution:

  • Removed the check box "Pure distinct" leaving only Distinct checked within Query options (under advanced)
  • Added a new field (Content: Nid) - and choose count (DISTINCT) as the aggregation setting.

Upvotes: 3

Muhammad Reda
Muhammad Reda

Reputation: 27043

In your view's advanced section and make sure you have the following option set:

  • Use aggregation is set to true.

After enabling this option, you will find Aggregation settings link added next to Fields and Filter Criteria.

Use Node nid as the distinct value or group by nid, whichever better fits your needs.

Upvotes: 2

Related Questions