我遇到了这个SQL搜索查询的问题,它完全搜索了我的'pages'表,但它没有从'blog_posts'表中返回任何结果。
SELECT
P.id,
P.title,
P.content_plain_text,
MATCH(P.title,
P.content_plain_text) AGAINST ('$searchTerm') AS score
FROM
pages AS P
WHERE
P.active = 1
AND MATCH(P.title, P.content_plain_text) AGAINST ('$searchTerm')
UNION
SELECT
F.id,
F.title,
F.content_plain_text,
MATCH(F.title,
F.content_plain_text) AGAINST ('$searchTerm') AS score
FROM
blog_posts AS F
WHERE
F.active = 1
AND MATCH(F.title, F.content_plain_text) AGAINST ('$searchTerm')
ORDER BY
score DESC