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) )
1.首先查询在follow 表中用户 music_id 时,他的关注人的follower_id,
select follower_id from follow where user_id=1
2.在music_likes表中用户user_id 是follower_id ,查询出music_id,并且限定music_id 不是user_id=1的music_id
#用户user_id 是follower_id
select music_id from music_likes where user_id in (select follower_id from follow where user_id=1)
#并且限定music_id 不是user_id=1的music_id
music_id not in (select music_id from music_likes where user_id=1) )
**推荐其关注的人喜欢的音乐。不要推荐该用户已经喜欢的音乐,
总的来说就是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.最后在表music中查询music_name
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) )