2012-04-28 55 views
0

table.a是InnoDB的有田id,post_id,auther,add_date選擇內部在哪裏比賽對一起返回0結果

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)

回答

0

我懷疑你不打算用於連接條件是

on a.post_id = 'b.post_id' 

而是

on a.post_id = b.post_id 

(所不同的是您的版本將加入b的每一行到a的任何行,其中a.post_id是字符串"b.post_id",而我的版本將a的行連接到行10他們各自的post_id列是相等的)。

+0

'上a.post_id = b.post_id'得到錯誤#1267'歸類(utf8_unicode_ci,隱含的)和(utf8_unicode_ci,隱含的)操作的非法混合=' – 2012-04-28 18:45:45

+0

在什麼字符集和校對是兩個'post_id'列編碼? – eggyal 2012-04-28 18:51:44

+0

謝謝,修正。一個表是'utf8_unicode_ci',另一個是'utf8_general_ci' – 2012-04-28 19:01:08