 <p>So here's what I've come up with:</p> <pre><code>$this-&gt;Sql = 'SELECT DISTINCT * FROM `nodes` `n` JOIN `tagged_nodes` `t` ON t.nid=n.nid'; $i=0; foreach( $tagids as $tagid ) { $t = 't' . $i++; $this-&gt;Sql .= ' INNER JOIN `tagged_nodes` `'.$t.'` ON ' .$t'.tid=t.tid WHERE '.$t.'.tid='.$tagid; } </code></pre> <p>It's in PHP since I need it to be dynamic, but it would basically be the following if I needed, say, only 2 tags (<code>animals</code>, <code>pets</code>).</p> <pre><code>SELECT * FROM nodes n JOIN tagged_nodes t ON t.nid=n.nid INNER JOIN tagged_nodes t1 ON t1.tid=t.tid WHERE t1.tid='animals' INNER JOIN tagged_nodes t2 ON t2.tid=t.tid WHERE t2.tid='pets' </code></pre> <p>Am I on the right track?</p>