Fun with SQL

The Drupal version of WorldBeatPlanet is shaping up very nicely. Rather than using the song & review modules, I’m using a taxonomy to select song lyrics or reviews. I defined a required vocabulary with the terms story, lyrics, and review. To find all items of a specific type, I use the following SQL query:


SELECT n.nid, n.title
FROM node n
LEFT JOIN term_node t ON ( n.nid = t.nid )
LEFT JOIN term_data d ON ( t.tid = d.tid )
WHERE ( d.name = "lyrics" )

Comments are closed.