Joining tables
I have this query
SELECT U.user_id, U.user_name From users U
INNER JOIN USERS_FOLLOWERS UF ON
U.user_id=UF.follower_id
WHERE UF.user_id=1
To see who else is following a user, but i want to turn it around, and see
who a user is following. How do i do that?
And another question.
I have this query
select
u1.user_name as `user_name being followed`,
u2.user_name as `follower_name that followes`
from users_followers uf
join users u1 on u1.user_id = uf.user_id
join users u2 on u2.user_id = uf.follower_id
To fetch the corrosponding username from table users, how can i do that with the two previews querys?
Subject
Written By
Posted
Joining tables
June 03, 2015 03:03AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.