如何在“MATCH AGAINST”查询中添加另一个“AND”

时间:2012-03-13 16:15:11

标签: mysql match where against

我是新手,我无法获得此查询返回任何结果。 如何在下面的查询中添加AND paginas_taal = 'ned'? 任何人都有线索?

SELECT *
FROM (
  SELECT paginas_tekst AS Tekst, paginas_naam AS Naam, paginas_button AS Button, 'paginas' AS Tabel, '0' AS Parent,
  MATCH (
    paginas_tekst
  )
  AGAINST (
    'shoppers'
  ) AS Relevance
  FROM paginas
  WHERE MATCH (
    paginas_tekst
  )
  AGAINST (
    '+shoppers'
    IN BOOLEAN
    MODE
  )
  HAVING Relevance > 0.2
) AS testtabel
ORDER BY Relevance DESC
LIMIT 0, 30

TIA 克。汉斯

1 个答案:

答案 0 :(得分:0)

您可以在WHERE子句中的任何位置添加额外的AND子句。另请注意,您不需要外部查询,因此您应该能够使用

SELECT paginas_tekst AS Tekst, paginas_naam AS Naam, paginas_button AS Button, 
    'paginas' AS Tabel, '0' AS Parent,
    MATCH ( paginas_tekst ) AGAINST ( 'shoppers' ) AS Relevance
FROM paginas
WHERE MATCH ( paginas_tekst ) AGAINST ( '+shoppers' IN BOOLEAN MODE ) 
  AND paginas_taal = 'ned'
HAVING Relevance > 0.2
ORDER BY Relevance DESC
LIMIT 0, 30