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

merlinofchaos’s picture

Status: Active » Fixed

Assuming 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.

Ares_ekb’s picture

Thanks! It works. I'm not using a relationship.

I thought, that vocabulary ID will be included into query, but it surprisingly didn't.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.