本文介绍了MYSQL匹配查询两个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用联接对具有两个表的查询进行匹配?棘手的部分可能是表上的索引,但也许有一种方法.sql不是我的强项.非常感谢.我想可能是这样的:
Is it possible to do a match against a query with two tables using a join? The tricky part might be the index on the table but maybe there is a way.. sql is not my strong suit. Many thanks. I imagine it might be something like the following:
SELECT * FROM 'pages' p LEFT JOIN `tags` t ON p.id = u.pageid WHERE MATCH(p.shdescript,t.tag) AGAINST ('romance, relationship')非常感谢
推荐答案可能,但是您需要文本索引.
It's possible, but you need to have text indexes.
mysql> alter table pages add fulltext index_text(shdescript); mysql> alter table tags add fulltext index_text(tag); SELECT * FROM 'pages' p LEFT JOIN `tags` t ON p.id = u.pageid WHERE MATCH(p.shdescript,t.tag) AGAINST ('romance relationship')我想这足以工作.
从MySQL 5.6开始,上述全文搜索可以在MyISAM& InnoDB存储引擎.在早期的MySQL版本上,只有MyISAM表支持全文索引.
As of MySQL 5.6 the above fulltext search can be done on the MyISAM & InnoDB storage engines. On earlier MySQL versions only MyISAM tables supported fulltext indexes.
dev.mysql/doc/refman/5.6/en/fulltext-search.html
更多推荐
MYSQL匹配查询两个表
发布评论