0

I have "Episode" content type and some "Showing from" date field in it which is repeating (more than one value can be added). Then I have a view that list episodes ordered by that field, which works, but I want to exclude same episodes. Now if episode has i.e. 3 times that fulfill filter criteria episode will be listed 3 times. I checked "Distinct" option but it doesn't help - still episode is listed 3x. Actually I'm not very sure how Distinct works - is it possible to select a filed that has to be distinct (if yes - how?) or it works for all fields? I would like to set distinct on episode nid of course.

1
  • Apply a filter on the date field
  • Select the operator: 'Is equal to', and type '0'

When you have a multiple value field, the field has a list or array of values. delta=0 is the first value

https://www.drupal.org/node/1872262#comment-6869736

0

for that you can use aggregation with views i.e in advanced option in views from their you can use aggregation yes, and in that field click agregation settings set your option as distinct

6
  • I tried with grouping but without success. When I just turn on aggregation I got mySql error. Also, for all fields in their aggregation settings it's pre-select "Group results together". And there is no "Distinct" option to select?! There is "Count DISTINCT", but when I set that I get no results at all?! Where can I set that "distinct" option for specific field? Aug 11 '14 at 11:18
  • To be more precise if I turn on aggregation and in format settings I select the field I want to group by (node id) I get mySql error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS field_data_field_img_, field_data_field_show.field_show_nid AS field_data_fie' at line 1 Aug 11 '14 at 12:12
  • And the query I get starts with: SELECT DISTINCT field_data_field_img. AS field_data_field_img_, field_data_field_show.field_show_nid AS field_data_field_show_field_show_nid, field_data_field_season.field_season_value AS field_data_field_season_field_season_value, field_data_field_episode.field_episode_value AS field_data_field_episode_field_episode_value, field_data_body.body_value AS field_data_body_body_value, node.nid AS nid_1, node.title AS node_title, field_data_field_video_id.field_video_id_value AS field_data_field_video_id_field_video_id_value, node.created ... Aug 11 '14 at 12:15
  • First field that I'm getting is image from that "episode" content type, but it "field_data_field_img." looks suspicious to me - every where else is something.something and for image field variable after dot is missing. Aug 11 '14 at 12:16
  • Is image field somehow specific? Do I have to set something there when I turn on aggregation? Aug 11 '14 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.