Created
January 10, 2012 23:31
-
-
Save techieshark/1591895 to your computer and use it in GitHub Desktop.
(Drupal) SQL to count #nodes in each term in each vocabulary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT v.vid, v.name AS Vocabulary, td.tid, td.name AS Term, (SELECT count(*) FROM drupal_node n JOIN drupal_term_node tn2 ON n.nid = tn2.nid WHERE tn2.tid = td.tid) AS Count FROM drupal_vocabulary v JOIN drupal_term_data td ON v.vid = td.vid ORDER BY Count DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment