Adding the distinct filter to a view does not remove multiple results. I downgraded to 5.x-1.5 and it worked wonderfully.

Comments

fago’s picture

I've just tested the filter again and it's working for me. With which filters are you combining DISTINCT? Could you export your view?

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

The same is true for me; I can't reproduce this without significantly more information.

omar’s picture

Version: 5.x-1.6-beta4 » 5.x-1.6
Status: Postponed (maintainer needs more info) » Active

I can reproduce this problem. It seems to be independent of the "view type" and instead is related taxonomy terms associated to returned nodes.

Testing has revealed that the node is repeated according to the number of terms (cummulative over multiple vocabularies) associated to the returned node.

Note that in my case, the view in question only looks for "published" + content type "is one of" + is "distinct". i.e. it doesn't even refer to taxonomy.... and no, adding taxo filters didn't seem to change anything.

In case it makes a difference.. note that I am also using i18n.

Etanol’s picture

Priority: Normal » Critical

I can confirm it as well with 1.6 +

It's just node type + published + distinct, ordered by time published

the query is

SELECT DISTINCT(node.nid), comments.timestamp AS comments_timestamp_timestamp, node.title AS node_title, node.changed AS node_changed FROM node node LEFT JOIN comments comments ON node.nid = comments.nid WHERE (node.type IN ('rec')) AND (node.status = '1') GROUP BY node.nid, comments_timestamp_timestamp ORDER BY comments_timestamp_timestamp DESC LIMIT 0, 5

the view is:

  $view = new stdClass();
  $view->name = 'Najnowsze_recenzje';
  $view->description = 'Najnowsze recenzje na Giery.eu';
  $view->access = array (
  0 => '1',
  1 => '2',
  2 => '3',
);
  $view->view_args_php = '';
  $view->page = FALSE;
  $view->page_title = '';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'node';
  $view->url = '';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->block = TRUE;
  $view->block_title = 'Recenzje';
  $view->block_header = '';
  $view->block_header_format = '1';
  $view->block_footer = '';
  $view->block_footer_format = '1';
  $view->block_empty = '';
  $view->block_empty_format = '1';
  $view->block_type = 'list';
  $view->nodes_per_block = '5';
  $view->block_more = FALSE;
  $view->block_use_page_header = FALSE;
  $view->block_use_page_footer = FALSE;
  $view->block_use_page_empty = FALSE;
  $view->sort = array (
    array (
      'tablename' => 'comments',
      'field' => 'timestamp',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array (
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink_with_mark',
      'options' => 'link',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'distinct',
      'operator' => '=',
      'options' => '',
      'value' => array (
  0 => 'distinct',
),
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'rec',
),
    ),
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(comments, node);
  $views[$view->name] = $view;

there are multiple reports of this error - will it be ever fixed?

mariagwyn’s picture

It is possible I am having the same problem.

I am filtering, in this order:
Node, published, yes
Taxononomy for vocab X, 'is one of', about 5 selected terms.
Node: distinct

Arguments: summary sorted ascending.
Sort: Sticky and creation date.

If I remove 'Node:distinct' on the first page of the view, I see the list of terms with number of posts in parenthesis, if I click on the term, it shows the teasers of the nodes. If I keep 'Node: distinct', the list of terms on the first page repeats various terms with (1) following the term, and does not show other terms (which I know have nodes). However, when I click the term, there is more than one listing under the term.

Maria

catch’s picture

Status: Active » Closed (duplicate)
kulfi’s picture

I have marked my http://drupal.org/node/294748 as a duplicate of this one, but now I'm no longer sure. Distinct is not being enforced, but I am not filtering by taxonomy?

ashishkuc’s picture

Version: 5.x-1.6 » 7.x-3.0-beta3

In Drupal 7 Add Distinct option from Views->advanced -> Query Settings

gnupdg’s picture

I have the same problem, i add "distinct" from "views -> advanced -> query settings" but it still doesn't work

rfulcher’s picture

I am having the same issue. Have an event content type with two dates and the event shows up twice. I want the event to show up once in the list. Query settings distinct is not dropping the second listing.