sqlserver 交叉去重
SELECT * FROM [dbo].[I_Friend] T1
WHERE NOT EXISTS(SELECT 1 FROM [dbo].[I_Friend] T2 WHERE T1.UserId=T2.FriendUserId
AND T1.FriendUserId=T2.UserId AND T1.UserId>T2.UserId) and T1.UserId!= T1.FriendUserId
表名:I_Friend
去重的两个字段:UserId,FriendUserId