Gaurav Raj

Gaurav Raj

  • NA
  • 475
  • 82.7k

mutual friends query

Jul 13 2017 12:14 AM
CREATE TABLE [dbo].[Friends] (
[FriendshipId] INT IDENTITY (1, 1) NOT NULL,
[MyId] INT NULL,
[FriendId] INT NULL,
[Status] INT NULL,
[MeOnline] INT NULL,
[FriendOnline] INT NULL,
[PingStatus] INT NULL
);
--this view friends
CREATE VIEW [dbo].[frdsView]
AS
select MyId,Id,F_Name+' '+L_Name as Name,Pic,Counttry,case when Status=1 then'Friends' else 'Request send'end as friend from
RegisterTable full outer join FriendsTable on FriendId=Id
where MyId=MyId
--how can i find mutual friends

Answers (1)