1

table.a 是 innodb 有字段id,post_id,auther,add_date

table.b 是 myisam 有字段post_id,title,content,全文键(标题,内容)

select * from b 
where match (title,content) 
against ('+words' in boolean mode)

这可能会返回 12 条记录。运行解释时,我可以看到全文键。但

select * from a 
inner join b 
on a.post_id = 'b.post_id' 
where match (b.title,b.content)
against ('+words' in boolean mode)
and a.auther = 'someone'
order by a.id asc

此返回 0 结果。我检查过

select id,auther,post_id from a where auther = 'someone' 

返回post_id放在mysql中

select post_id from b where post_id = 'post_id from table a'

这个结果是存在的。那么问题出在哪里?(顺便说一句,2个表post_id都保存为varchar)

4

1 回答 1

0

我怀疑你不打算让加入条件成为

on a.post_id = 'b.post_id'

反而

on a.post_id = b.post_id

(不同之处在于您的版本将每一行连接到string所在的b任何行,而我的版本会将行连接到它们各自列相等的行)。aa.post_id"b.post_id"abpost_id

于 2012-04-28T18:38:43.437 回答