Getting mysql row that doesn't conflict with another row
Posted
by
user939951
on Stack Overflow
See other posts from Stack Overflow
or by user939951
Published on 2012-06-11T04:31:48Z
Indexed on
2012/06/11
4:39 UTC
Read the original article
Hit count: 297
I have two tables that link together through an id one is "submit_moderate" and one is "submit_post"
The "submit_moderate" table looks like this
id moderated_by post
1 James 60
2 Alice 32
3 Tim 18
4 Michael 60
Im using a simple query to get data from the "submit_post" table according to the "submit_moderate" table.
$get_posts = mysql_query("SELECT * FROM submit_moderate WHERE moderated_by!='$user'");
$user
is the person who is signed in.
Now my problem is when I run this query, with the user 'Michael' it will retrieve this
1 James 60
2 Alice 32
3 Tim 18
Now technically this is correct however I don't want to retrieve the first row because 60 is associated with Michael as well as James. Basically I don't want to retrieve that value '60'.
I know why this is happening however I can't figure out how to do this. I appreciate any hints or advice I can get.
© Stack Overflow or respective owner