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

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -