题解 | #网易云音乐推荐(网易校招笔试真题)#
网易云音乐推荐(网易校招笔试真题)
https://www.nowcoder.com/practice/048ed413ac0e4cf4a774b906fc87e0e7
with fid as(select f.user_id,follower_id,music_id from follow f left join music_likes m on f.follower_id=m.user_id where f.user_id=1 and music_id not in ( select music_id from music_likes where user_id=1 )) select music_name from fid join music on fid.music_id=music.id group by music_name,music.id order by music.id
在SQL查询中遇到“Expression #1 of ORDER BY clause is not in SELECT list, references column 'music.id' which is not in SELECT list; this is incompatible with DISTINCT”的错误时,这意味着你在使用DISTINCT关键字的同时,在ORDER BY子句中引用了未在SELECT列表中的列