sql - Stop getting same result twice in mySQL -
i'm doing microblogging site (like twitter) using mysql database. in database have 3 tables: 1 users, 1 messages , 1 control follows who. when user enters site want show own messages , people follows, use query:
select * messages inner join users on users.id = messages.author inner join followers on followers.main_user = 2 messages.author = followers.followed_user or messages.author = 2 order date desc;
being '2' user that's entering site.
the thing messages written person enters (2, in example) twice, , once people follows. have clue how solve this? user 2 doesn't follow himself.
Comments
Post a Comment