Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在mysql中文本搜索多个列并按列排序?_Mysql - Fatal编程技术网

如何在mysql中文本搜索多个列并按列排序?

如何在mysql中文本搜索多个列并按列排序?,mysql,Mysql,我正在A、B、C栏中搜索“你好”一词 我希望按搜索列的顺序返回结果 例如返回所有a列结果,然后返回b列,然后返回c列 这可能吗?我现在正在做这件事 SELECT * FROM `table` where table.A LIKE "%hello%" OR table.B LIKE "%hello%" OR table.C LIKE "%hello%" 使用联合: SELECT * FROM `table` where A LIKE "%hello%" UNION SELECT * FROM

我正在A、B、C栏中搜索“你好”一词

我希望按搜索列的顺序返回结果

例如返回所有a列结果,然后返回b列,然后返回c列

这可能吗?我现在正在做这件事

SELECT * FROM `table` where table.A LIKE "%hello%" OR table.B LIKE "%hello%" OR table.C LIKE "%hello%"

使用
联合

SELECT * FROM `table` where A LIKE "%hello%" 
UNION
SELECT * FROM `table` where B LIKE "%hello%"
UNION
SELECT * FROM `table` where C LIKE "%hello%"