Here’s a mysql table : friends :
followed INT, <-- The user's id ( the follower is following him )
followedby INT <-- The follower's id
and table updates :
updateid INT,
updatetext TEXT,
updatetime DATETIME
uid INT
A guy with the userid 2 is logged in and want to see the updates of the users he follows.
Right now, he only follows 3 users. To select the updates I can do execute this:
SELECT * FROM updates WHERE ( uid=10 , uid=20 OR uid=30 ) ORDERBY updatetime DESC LIMIT 10
Problems
I want to select the users who are followed by the loggedin user and want to select the updates by those users.
The user can have many friends. Please help.
You can use subquery and
IN()