SELECT * FROM tblPosts WHERE tblPosts.usersID = (SELECT tblFriends.friendsID WHERE tblFriends.myID = '$myID') ORDER BY tblPosts.date DESC;

Advertisements SELECT * FROM tblPosts WHERE tblPosts.usersID = (SELECT tblFriends.friendsID WHERE tblFriends.myID = ‘$myID’) ORDER BY tblPosts.date DESC; This doesn’t through an error but it also doesn’t work. I think I need a join statement maybe? There are several fields in tblPost. ID, Comment, Date, userID, etc… Using my $myID variable I want to output… Read More SELECT * FROM tblPosts WHERE tblPosts.usersID = (SELECT tblFriends.friendsID WHERE tblFriends.myID = '$myID') ORDER BY tblPosts.date DESC;

Using SQL check to see if an ID in Table A exists in Table B. If that ID exists in Table B return corresponding value

Advertisements I have a table call it Table A. Table A with an ID column ID1 associated with a row. That table looks like the following: ID1 A1.0 B2.0 C3.0 A1.0 … I have a second table call it Table B that has an ID and a corresponding value. That table looks like the following:… Read More Using SQL check to see if an ID in Table A exists in Table B. If that ID exists in Table B return corresponding value