且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL:如何在多个表中搜索任何列中存在的字符串

更新时间:2023-11-26 22:05:40

添加全文索引至所有这些表中的所有字符串列,然后合并结果

Add fulltext indexes to all of the string columns in all of those tables, then union the results

select * from table1 where match(col1, col2, col3) against ('some string')
union all
select * from table2 where match(col1, col2) against ('some string')
union all
select * from table3 where match(col1, col2, col3, col4) against ('some string')
...