How i can get from these tables the list of Member and his friend name and friend id?
I need the four column output-:
1) MemberId
2) MemberName,
3) FriendId
4) FriendName
- create table #temp(Memberid int,Name varchar(500))
- Insert into #temp(Memberid,Name)values(1,'Anil Thakur')
- Insert into #temp(Memberid,Name)values(2,'Ankit')
- Insert into #temp(Memberid,Name)values(3,'Sonia')
- Insert into #temp(Memberid,Name)values(4,'Airi')
-
- Create table #temp1(id int,SenderIdId int,ReceiverId int, status varchar(2))
- insert into #temp1(id,SenderIdId,ReceiverId,status)values(1,1,2,'A')
- insert into #temp1(id,SenderIdId,ReceiverId,status)values(2,2,4,'A')
- insert into #temp1(id,SenderIdId,ReceiverId,status)values(3,3,1,'A')
- insert into #temp1(id,SenderIdId,ReceiverId,status)values(4,4,1,'A')
- insert into #temp1(id,SenderIdId,ReceiverId,status)values(4,4,2,'A')