我正在尝试UNION从 Drupal 和 phpBB 表中发表评论和帖子。
这是我的 SQL:
(
SELECT f.forum_name AS section,
p.topic_id,
p.forum_id,
p.post_id,
p.poster_id AS uid,
u.username AS user,
p.post_time AS post_time,
p.post_subject AS subject
FROM phpbb_posts p
JOIN phpbb_forums f ON f.forum_id = p.forum_id
JOIN phpbb_topics t ON p.post_id = t.topic_last_post_id
JOIN phpbb_users u ON p.poster_id = u.user_id
)
UNION (
SELECT NULL AS section,
comments.nid AS topic_id,
NULL AS forum_id,
comments.cid AS post_id,
comments.uid AS uid,
comments.name AS user,
comments.timestamp AS post_time,
comments.subject AS …Run Code Online (Sandbox Code Playgroud)