Help Creating Join for Topic Content on a Custom Import
-
Hi,
Could someone help me with the syntax for the following join
SELECT
maoriorg_exportoldforums.pp_threads.thread_subject,
maoriorg_exportoldforums.pp_posts.post_message,
maoriorg_exportoldforums.pp_threads.thread_id
FROM
maoriorg_exportoldforums.pp_posts
INNER JOIN maoriorg_exportoldforums.pp_threads
ON maoriorg_exportoldforums.pp_posts.post_id = maoriorg_exportoldforums.pp_threads.thread_id
GROUP BY
maoriorg_exportoldforums.pp_threads.thread_idThis is what I have come up with so far, (compied from bbPress1.php to follow) but not sure how to put the GROUP BY clause
// Topic content. // Note: We join the 'posts' table because 'topics' table does not include content. $this->field_map[] = array( 'from_tablename' => 'posts', 'from_fieldname' => 'post_text', 'join_tablename' => 'topics', 'join_type' => 'INNER', 'join_expression' => 'USING (thread_id) WHERE posts.post_position IN (0,1)', 'to_type' => 'topic', 'to_fieldname' => 'post_content', 'callback_method' => 'callback_html' );
Mind you, I could also have the wrong fields in the wrong place so any corrections and help most appreciated.
Thank you for your time 🙂
- You must be logged in to reply to this topic.