- 参考答案
select music_name from music
where id in (
select music_id from music_likes
where user_id in(
select follower_id from follow
where user_id = 1)
and
music_id not in (select
music_id from music_likes
where user_id = 1)
)
- 答案解析
- 找到user_id=1关注的人:
select follower_id from follow
where user_id = 1
- 找到他专注的人喜欢的音乐id,并且去除他喜欢的音乐id
select music_id from music_likes
where user_id in(
select follower_id from follow
where user_id = 1)
and
music_id not in (select
music_id from music_likes
where user_id = 1)
3.查询音乐名字,上面两步就是限制条件