Users Table:
ID, UserName, Location
Follow Table:
ID, User_ID, User_Follow_ID
--User_ID --> ID of user who is following
--User_Follow_ID --> ID of user being followed
I want to get the Username, location of people whose location is same as the 'User' and i also want to know whether the user is following them or not. The query i have written to get people in the same location is as follows:
String query = @"
select *
from User
where Location = (
select Location
from Users
where UserName ='abc'
) and UserName != 'abc'
";
I need to modify this query to connect to or include data from the Follow table as well.
I'm using PostgreSql DB and writing code in C#. Any help or suggestion will be appreciated!