我在下面有查询,并想删除子查询,因为它减慢了查询速度。我已经尝试了LEFT JOIN,但返回的结果为零。如何删除子查询?
SELECT DISTINCT releases.*
FROM releases
INNER JOIN artist_love ON releases.all_artists LIKE CONCAT('%',artist_love.artist,'%')
AND artist_love.user = 'Quickinho'
INNER JOIN label_love ON label_love.label = releases.label_no_country
AND label_love.user = 'Quickinho'
AND releases.id NOT IN
(
SELECT release_id
FROM charts_extended
WHERE artist = 'Quickinho'
)
ORDER BY releases.date DESC
LIMIT 0 , 102
最佳答案
SELECT DISTINCT releases.*
FROM releases
INNER JOIN artist_love ON releases.all_artists LIKE CONCAT('%',artist_love.artist,'%')
AND artist_love.user = 'Quickinho'
INNER JOIN label_love ON label_love.label = releases.label_no_country
AND label_love.user = 'Quickinho'
left join charts_extended on charts_extended.release_id=label_love=releases.id and charts_extended.artist = 'Quickinho'
where charts_extended.release_id is null
ORDER BY releases.date DESC
LIMIT 0 , 102