Filippo oretti
Filippo oretti

Reputation: 49813

MySQL query match with alias WHERE not working

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 :/

Upvotes: 1

Views: 702

Answers (2)

xkeshav
xkeshav

Reputation: 54032

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

HAVING score > 0 instead of WHERE

Upvotes: 4

Joe Stefanelli
Joe Stefanelli

Reputation: 135818

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

Upvotes: 1

Related Questions