Skip to content

Instantly share code, notes, and snippets.

@ntwb
Created February 12, 2013 04:06
Show Gist options
  • Save ntwb/4760163 to your computer and use it in GitHub Desktop.
Save ntwb/4760163 to your computer and use it in GitHub Desktop.
SELECT `forum`.`ID`, `forummeta`.`meta_value`, `group`.`id`
FROM `wp_posts` AS `forum`
LEFT JOIN `wp_postmeta` AS `forummeta`
ON `forum`.`ID` = `forummeta`.`post_id`
AND `forummeta`.`meta_key` = '_bbp_old_forum_id'
LEFT JOIN `wp_bp_groups` AS `group`
ON `group`.`slug` = `forum`.`post_name`
WHERE `forum`.`post_type` = 'forum' AND `group`.`id` > 0
GROUP BY `forum`.`ID`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment