SQL搜索查询返回没有结果

时间:2012-01-22 11:15:55

标签: mysql sql

我遇到了这个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

0 个答案:

没有答案