简体   繁体   中英

Full text search query generating error, why?

Why do I get a MySQL error from this query?

SELECT *, MATCH($SW) AGAINST(reb, keb, gloss) as Score 
FROM dictionary 
WHERE MATCH($SW) AGAINST(reb, keb, gloss) 
ORDER BY Score DESC;

I'm trying to test Full Text search but I can't create a working query it seems like.

It would be nice if you gave the error message, but I think I can guess the fix. You forgot to quote the strings:

SELECT *, MATCH('$SW') AGAINST(reb, keb, gloss) as Score 
FROM dictionary 
WHERE MATCH('$SW') AGAINST(reb, keb, gloss) 
ORDER BY Score DESC;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM