I have two objects: Users and Friends, which look like this:
public class User { public int UserId { get; set; } (...) } public class Friendship { public int SenderId { get; set; } public int ReceiverId { get; set; } (...) }
And I would like to create a simple query that in SQL would look like this:
SELECT * FROM Users as U INNER JOIN Friendships as F ON U.UserId = F.ReceiverId OR U.UserId = F.SenderId Where U.Nick != VARIABLE
In other words, I would like to select all the friends of the user.
And I canβt do it. I found a solution where you create two separate join requests with a join and it works, but it is inefficient to create such a request for db.
source share