11

如何搜索 in table_a table_b table_c,其中包含随机数列的字符串?

我知道这不是正确的 sql,但它会是这样的:

SELECT * FROM users, accounts, something_else WHERE ->ANY COLUMN CONTAINS 'this_string'<-

提前为 SO 社区提供 Ty

4

1 回答 1

30

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

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')
...
于 2008-12-26T17:56:20.737 回答