i want to implement following system in my application , something like twitter type of following system,
I have a table posts where all the posts by users are stored, the structure of this table is as follows:
id | user_id | title | description | image_addr | date
and this is my table_users structure :
id | email | name | password | reg_date
and this is my follow_table structure :
user_id | following_user_id
in follow table i will store data of which user follow who , for example if user_id 1 is following userid 10 then i will store this information in this table
i don't know exactly that my MySQL database structure is OK or not to get best optimization for queries , but i tried to make it on a good way , if you have any suggestion i will be happy to hear it
But now i this is my main question , how i should write the query to get posts of users that user is following ,
for example i follow 10 people , and they all have some posts in posts table , i want to write a query command to return the user posts that i followed ... i will be very very very thankful if you can help me ... thanks