题目链接:点击打开链接
题目大意:略。
解题思路:略。
AC 代码
--解决方案(1) WITHt1AS(SELECTuser2_iduser_idFROMFriendshipWHEREuser1_id=1UNIONSELECTuser1_idFROMFriendshipWHEREuser2_id=1) SELECTDISTINCTpage_idrecommended_pageFROMLikesliJOINt1ONli.user_id=t1.user_idWHEREpage_idNOTIN (SELECTpage_idFROMLikesWHEREuser_id=1) --解决方案(2) SELECTDISTINCTpage_idASrecommended_pageFROMLikesWHEREuser_idIN ( SELECTuser1_idASuser_idFROMFriendshipWHEREuser2_id=1UNIONALLSELECTuser2_idASuser_idFROMFriendshipWHEREuser1_id=1) ANDpage_idNOTIN ( SELECTpage_idFROMLikesWHEREuser_id=1)