我正在 A、B、C 列中搜索单词“hello”。
我希望结果按照搜索列的顺序返回..
EG 返回所有 a 列结果,然后是 b 列,然后是 c 列。
这可能吗?我目前正在做这个。
SELECT * FROM `table` where table.A LIKE "%hello%" OR table.B LIKE "%hello%" OR table.C LIKE "%hello%"
最佳答案
使用UNION
:
SELECT * FROM `table` where A LIKE "%hello%"
UNION
SELECT * FROM `table` where B LIKE "%hello%"
UNION
SELECT * FROM `table` where C LIKE "%hello%"
关于mysql - 我如何在mysql中文本搜索多个列并按列排序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24096399/