I am having a problem with views. I have a view and am passing it a taxonomy term by name to it. I then have a relationship to a related node. For my output fields I am returning the related Title and related Body. I however have duplicates in my results. I have turned distinct to yes but believe this is working on the nodes being return and not the related node. Any ideas how I can remove the duplicates?
Update
Below is the query being run when I only get the title
SELECT DISTINCT(node.nid) AS nid,
node_node_data_field_wine_company.title AS node_node_data_field_wine_company_title,
node_node_data_field_wine_company.nid AS node_node_data_field_wine_company_nid
FROM node node
LEFT JOIN content_type_wine node_data_field_wine_company ON node.vid = node_data_field_wine_company.vid
INNER JOIN node node_node_data_field_wine_company ON node_data_field_wine_company.field_wine_company_nid = node_node_data_field_wine_company.nid
LEFT JOIN term_node term_node ON node.vid = term_node.vid INNER JOIN term_data term_data ON term_node.tid = term_data.tid
WHERE term_data.name = 'test'
GROUP BY nid
It looks like I should be grouping by node_node_data_field_wine_company_nid or selecting distinct values from there. Any ideas?
Update
It may not be possible using Normal vies. Below is my set up.
I have a taxonomy called Region. A region is applied to a custom content type called Wine. The Wine content type have a node reference field to a Company node type. Company is a custom node type.
I have a view listing all my regions. Clicking on the region I will pass that as an argument to a view (term name). From this region I want to return all the companies in that region.
To get this I need to get all the Wine items which have that region. With all the wine items with the region I need to get the unique company node reference. I will then return this.
One way round it would to be to give each company a region(s) to make the list. However I would rather it was worked out automatically from the wine type.
Any ideas?