MySQL query match with alias WHERE not working

折月煮酒 提交于 2019-12-20 05:31:57

问题


why does my sintax is not right?

SELECT *,
           MATCH(tags,title,description) AGAINST ('asd jhbdckdsb' IN BOOLEAN MODE) AS score 
      FROM blogs WHERE score > 0
  ORDER BY score DESC, insert_datetime DESC, id DESC ; 

the problem seems to be on WHERE condition :/


回答1:


invisible columns and column alias are not allowed in WHERE so use HAVING

HAVING score > 0 instead of WHERE




回答2:


You cannot use a column alias in the WHERE clause. You must repeat the MATCH a second time.



来源:https://stackoverflow.com/questions/12430516/mysql-query-match-with-alias-where-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!