Fenhopi Posted June 25, 2011 Share Posted June 25, 2011 I want my query to return the values where person='$username' and status=0 from one table, and the same in another table. Here's what I got: $GetStatus = "SELECT comments.status, friends.status FROM comments, friends WHERE (comments.person='$username' AND comments.status='0') OR (friends.user2='$username' AND friends.status='0')"; However it just returns values from different rows where the status is different than 0.. Link to comment https://forums.phpfreaks.com/topic/240409-cant-figure-this-query-out/ Share on other sites More sharing options...
jcbones Posted June 26, 2011 Share Posted June 26, 2011 Is there a collision where the comments status is not 0, and the friends status is 0, or vice versa? Link to comment https://forums.phpfreaks.com/topic/240409-cant-figure-this-query-out/#findComment-1234843 Share on other sites More sharing options...
Fenhopi Posted June 26, 2011 Author Share Posted June 26, 2011 Yeah.. Possibly. I just want to find which rows have the right username as well as the status: 0, and have them returned.. And I really thought the query would do that.. Link to comment https://forums.phpfreaks.com/topic/240409-cant-figure-this-query-out/#findComment-1234850 Share on other sites More sharing options...
efficacious Posted June 26, 2011 Share Posted June 26, 2011 could you just run two queries? Link to comment https://forums.phpfreaks.com/topic/240409-cant-figure-this-query-out/#findComment-1234855 Share on other sites More sharing options...
Fenhopi Posted June 26, 2011 Author Share Posted June 26, 2011 That's what I ended up doing. Something the obvious takes awhile to see. Link to comment https://forums.phpfreaks.com/topic/240409-cant-figure-this-query-out/#findComment-1234965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.