0
SELECT id, title, keywords, post, img,
NULL as device_id, null as mfgr, null as model, null as img
FROM blog_posts WHERE MATCH(title, desc_meta, keywords_meta, post) AGAINST('boost')
UNION ALL
SELECT NULL, NULL, NULL, NULL, id AS device_id, mfgr, model, img, summary
FROM device_specs WHERE MATCH(mfgr, model, summary) AGAINST('boost');
考慮上面的查詢,兩個表格沒有任何共同之處。這僅用於搜索腳本。我將如何去保持與兩個組合表的相關性?上面的查詢工作,但在所有情況下,blog_posts
的結果出現在device_specs
的結果之前。mysql:聯合所有和按相關性排序?
將其包裝在子查詢中,並且只是按'order by'? – Peter