Skip to content

Instantly share code, notes, and snippets.

@bangpound
Created October 9, 2009 17:19
Show Gist options
  • Save bangpound/206182 to your computer and use it in GitHub Desktop.
Save bangpound/206182 to your computer and use it in GitHub Desktop.
Drupal 6 taxonomy SQL: select all terms with no children.
SELECT t.* FROM term_data t
INNER JOIN term_hierarchy h ON h.tid = t.tid OR h.parent = t.tid
WHERE t.vid = %d
GROUP BY t.tid
HAVING COUNT(t.tid) = 1
ORDER BY weight,name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment