1.查询重复值(查询UserName相同的列)
select * from tb_userinfo where UserName in(select UserName from tb_userinfo group by UserName Having COUNT(UserName)>1)
2.查询出UserID与FriendId会为好友的列
select * from tb_Friend F where exists (select 1 from tb_Friend where UserID = F.FriendID and FriendID = F.UserID)