php - MySQL Query adding another condition -
here query:
select photos.* photos inner join follows on photos.userid=follows.followingid follows.followerid = $myid order photos.id desc limit 10
how add condition correctly can check photos user's id (using $myid variable)?
update: added conditional in syntax provided in answer, shows images users you're following not own photos though.
update 2: table structures:
from question difficult gather how tables set up, may you're looking for:
select photos.* photos left outer join follows on photos.userid=follows.followingid follows.followerid = $myid or photos.userid = $myid order photos.id desc limit 10
edit: see you're trying do, need left outer join include every result photos table, should work.
Comments
Post a Comment