List all related terms of a term

Last modified: November 8, 2008 - 20:54

To find all related terms of a taxonomy term use this SQL code:

SELECT tid, name
FROM term_relation
INNER JOIN term_data
  ON (tid1 = tid OR tid2 = tid)
WHERE (tid1 = %d OR tid2 = %d)
  AND tid != %d;

Replace %d to the tid (ID of taxonomy term) of which you want to find the related terms.

 
 

Drupal is a registered trademark of Dries Buytaert.