我正在使用此查询从两个表中获取结果:
SELECT * FROM (
SELECT parent_id as mID, count(*) as cnt
FROM wp_forum_posts
WHERE text LIKE '%{$word}%'
GROUP by 1
UNION ALL
SELECT id, count(*)
FROM wp_forum_threads
WHERE subject LIKE '%{$word}%'
GROUP by 1) x
ORDER BY 2, 1
我想从中选择更多值wp_forum_threads
。之类的值subject
。我怎样才能做到这一点?简单地在后面添加id
是行不通的。那么查询不返回任何结果。