Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2010 at 04:18 UTC
Updated:
21 Dec 2010 at 15:50 UTC
I have a very simple view, which returns a list of a node's taxonomy terms. It generates a folowing query:
SELECT
term_data.tid AS term_data_tid,
term_data.name AS term_data_name,
term_data.vid AS term_data_vid
FROM drupal_node node
LEFT JOIN drupal_term_node term_node ON node.vid = term_node.vid
LEFT JOIN drupal_term_data term_data ON term_node.tid = term_data.tid
WHERE node.nid = 107
The problem is that it returns 1 empty row (NULL, NULL, NULL) for nodes without taxonomy terms. I guess that LEFT JOINs should be replaced with INNER JOINs.
How to fix it?
Thanks.
Comments
Comment #1
merlinofchaos commentedAssuming you're using the Node: Related terms relationship, add a filter on...probably taxonomy: vocabulary is easiest, and use the NOT EMPTY operation.
If not using the relationship, the not empty operation might appear, but if you filter to an existing vocabulary that will work too.
Comment #2
Ares_ekb commentedThanks! It works. I'm not using a relationship.
I thought, that vocabulary ID will be included into query, but it surprisingly didn't.