Spring Posted May 5, 2011 Share Posted May 5, 2011 How could I do something like this? $sql = "SELECT post_text from posts WHERE poster_id = users.userid"; Quote Link to comment Share on other sites More sharing options...
requinix Posted May 5, 2011 Share Posted May 5, 2011 Use a JOIN. SELECT users.whateveryouwant, posts.post_text FROM posts JOIN users ON posts.poster_id = users.userid Quote Link to comment Share on other sites More sharing options...
fugix Posted May 5, 2011 Share Posted May 5, 2011 yep, if the fields from different tables match, use left or right join, otherwise use full join Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.