题解 | #网易云音乐推荐(网易校招笔试真题)#
网易云音乐推荐(网易校招笔试真题)
http://www.nowcoder.com/practice/048ed413ac0e4cf4a774b906fc87e0e7
SELECT
DISTINCT music_name
FROM
follow as a
LEFT JOIN
music_likes as b
ON
a.follower_id=b.user_id
LEFT JOIN
music as c
ON
b.music_id=c.id
WHERE
a.user_id=1 and
music_id not in
(SELECT music_id
FROM music_likes
WHERE user_id=1)
ORDER BY
c.id ASC