我有一個mysql語句,用於匹配字符串到兩個數據庫中的字符串。我想排除也在另一個表中的結果,但是當我添加conv_progress的左連接時,它會打破語句。任何人有任何想法如何排除在另一個表中的條目?搜索左加入null
作品
SELECT video.*,
MATCH(video.title) AGAINST(? IN BOOLEAN MODE) as cscore,
MATCH(tags.name) AGAINST(? IN BOOLEAN MODE) as htscore
FROM video
LEFT JOIN tags ON video.vid_id=tags.vid_id
null
WHERE
MATCH(video.title) AGAINST(? IN BOOLEAN MODE) OR
MATCH(tags.name) AGAINST(? IN BOOLEAN MODE) GROUP BY video.vid_id
ORDER BY cscore DESC LIMIT ?, ?
破碎
SELECT video.*,
MATCH(video.title) AGAINST(? IN BOOLEAN MODE) as cscore,
MATCH(tags.name) AGAINST(? IN BOOLEAN MODE) as htscore
FROM video
LEFT JOIN tags ON video.vid_id=tags.vid_id
LEFT JOIN conv_progress on video.vid_id=conv_progress.vid_id where conv_progress.vid_id is null
WHERE
MATCH(video.title) AGAINST(? IN BOOLEAN MODE) OR
MATCH(tags.name) AGAINST(? IN BOOLEAN MODE) GROUP BY video.vid_id
ORDER BY cscore DESC LIMIT ?, ?
感謝你的朋友你是我的英雄。 – Scarface