How do I avoid duplication in a view result? I want to list the states from the state/province field (handled by the Location module) in a content type. I used views, but it shows the same state name more than once.

I enabled distinct in the Views module, but it doesn't works. How can I avoid the same state name is shown more than once?

Current Result: Illinois, Georgia, Alabama, Illinois, Alabama, Alabama, Georgia.

I attached the screen shot of my view (I used table format and views group by module). 

Expected Result : Illinois, Georgia, Alabama. 

This is my views set up.



This is what I'm getting from my view.



I'm expecting this result no matter how many nodes have the same state; I want to display the state name only once.



This is the table style I used, and views group by module.
If Views' distinct parameter doesn't work for your case, you can always use a views_pre_render() hook to do anything with the result before it is rendered.  Something along the lines of...

YOURMODULE_views_pre_render(&amp;$view) {

  if ($view-&gt;name=='NAMEOFVIEW') {

    // drupal_set_message('&lt;pre&gt;' . print_r($view-&gt;result, TRUE) . '&lt;/pre&gt;');

    $states_found=array();

    foreach($view-&gt;result as $delta =&gt; $row) {

      if (in_array($row-&gt;LOCATION_FIELD_NAME_VALUE, $states_found)) {
        unset($view-&gt;result[$delta]);
      } else {
        $states_found[]=$row-&gt;LOCATION_FIELD_NAME_VALUE;
      }

    }

  }

  // any other pre_render()ing here...

}


What this does is loop through the rows of your view result keeping track of what states have been found and unsetting any duplicates.  The commented out dsm at the beginning will help you figure out what LOCATION_FIELD_NAME_VALUE you need to use in your specific case.