select music_name from music where id in
(
select music_id from music_likes left join follow on music_likes.user_id = follow.follower_id where follow.user_id=1
) and id not in
(select music_id from music_likes where user_id=1)
order by id
思路:
1.求出user_id为1的人喜欢的音乐id
select music_id from music_likes where user_id=1
2.求出user_id为1的人关注的人喜欢的音乐id,将music_likes和follow表join连接即可
select music_id from music_likes left join follow on music_likes.user_id = follow.follower_id
where follow.user_id=1
3.从music中筛选出来已关注人喜欢的音乐,并剔除自己喜欢的音乐
select music_id from music_likes left join follow on music_likes.user_id = follow.follower_id
where follow.user_id=1
order by id