alright, I've been banging my head against this query for the past couple of days. Here's the deal, I hope I don't confuse you too much trying to explain this. I have 3 tables(listed below). Table 1 has general site login crap, table2 has application specific info(there will be more of these later), and table3 has information that has been used already.



Every email in table2 will be in table1, but not neccessarily the other way around. Table3 is organized so after a user selects an item, that item is populated in table3 with the user's email and the code of the product selected.

Example: is signed up for the app, so he has an entry there. He has already selected several codes, so he has a few entries in table3. The tables might look something like this now:
Table1: mypassword 06-04-2010 mypassword 06-04-2010 mypassword 06-04-2010 mypassword 06-04-2010 mypassword 06-04-2010 mypassword 06-04-2010 mypassword 06-04-2010

Table2: cat1 111111 cat1 222222 cat1 333333 cat1 444444 cat2 555555 cat1 666666

Table3: 222222 444444 111111 444444
Using this, I'm hoping to display table2 items who's catagory matches the user's AND who's code is not listed in table3 next to the user's email. So, if joe were logged in, it would display items: cat1 333333 cat1 666666

This is what I've got right now. I know the third statement( $query .= "AND '$email'!=`$table2`.email "; ) is one of the problems. I'm not even sure if it is possible with this setup, so if need be, I'd even be willing to reorganize the tables...just keep in mind that down the road other apps will be added, and they will get their own table2 and table3.

Code: code to get logged in user's information and set to $email, $category, and $code...

 $query = "SELECT * FROM table1, table2, table3 ":
 $query .= "WHERE '$category'=`$table2`.faction ";
 $query .= "AND '$category'=`$table2`.faction ";
 $query .= "AND '$code'!=`$table2`.code ";
 $query .= "AND '$email'!=`$table2`.email ";
Any ideas? I'm a bit of a mysql noob...but I google well in most cases!