Skip to content

Instantly share code, notes, and snippets.

@camwest
Created March 5, 2009 22:44
Show Gist options
  • Save camwest/74612 to your computer and use it in GitHub Desktop.
Save camwest/74612 to your computer and use it in GitHub Desktop.
EXPLAIN SELECT root_node.id, GROUP_CONCAT(children.id) as child_ids
FROM contents as root_node
LEFT JOIN contents as children ON root_node.id = children.parent_id AND children.parent_id = root_node.id AND children.content_type_id =6
WHERE root_node.content_type_id = 2
GROUP BY root_node.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment