Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My Table Design is below

CREATE TABLE [dbo].[FriendRelation](
[Id] [int] IDENTITY(1,1) NOT NULL,
[UserId1] [int] NULL,
[UserId2] [int] NULL,
[AreFriend] [varchar](10) NULL,
[CreatedDate] [varchar](50) NULL,
)


For I Want to get 1) Accepted friend request list 2)Pending Friend Reuest

Can any one give me a query for above table.? Thanks well in advance.
Posted
Comments
ZurdoDev 9-Sep-15 11:53am    
Write it out in pseudo code and then translate to sql if you need to. Do you know SQL at all?

For example, how do I know looking at your table which friend requests have been accepted and which ones are pending? I don't see any columns or tables that look like they would store that information.
Herman<T>.Instance 9-Sep-15 14:19pm    
AreFriend...BIT field not varchar(10). They are or not....
Niravvasoya 12-Sep-15 3:36am    
Because I will store F-Friend,D-Delete,B-Block,R-Requested like that...
Philippe Mori 9-Sep-15 14:56pm    
There are no reason to store users pairs that are not friends. And why would you use a string for AreFriend? Maybe a bit that indicate if the request was accepted.
Niravvasoya 12-Sep-15 3:40am    
Orelse some one can suggest me how the table will look like so that will design a table accordingly...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900