I can select using or with the sql statement
select f.userid, f.friend_userid from friends f where userid = 1 or friend_userid = 1;
now either userid or friend_userid is returning 1.
i want the two columns i.e userid and friend_userid to get merged
into a single column without 1
such that only one row is displayed…
the output i m getting is…
userid | friend_userid
1 | 2
1 | 7
1 | 5
12|1
24 | 1
I want to get displayed like…
userid
2
7
5
12
24
I m using mysql….
Thanks
Pradyut
India
So, you need the column friend_userid where condition “UserId=1” is met and UserId column when “friend_userid=1” condition is met. Write the following query:
And you get what you wanted.