[PHP] Item in two db tables

2001-04-04 Thread bill
If I want to find a list of items in one table whose id does not appear in another table, can that be done in one query? I can only figure it out if I use two queries. $result=mysql_query("SELECT id,item FROM table1"); while ($row=mysql_fetch_array($result)) { $thisid=$row["id"];

Re: [PHP] Item in two db tables

2001-04-04 Thread Joe Sheble (Wizaerd)
I'm not 100% certain about this, but I believe you want to look at using a LEFT OUTER JOIN At 11:37 AM 4/4/01 -0400, bill wrote: If I want to find a list of items in one table whose id does not appear in another table, can that be done in one query? I can only figure it out if I use two

Re: [PHP] Item in two db tables

2001-04-04 Thread Steve Werby
"bill" [EMAIL PROTECTED] wrote: If I want to find a list of items in one table whose id does not appear in another table, can that be done in one query? Absolutely. SELECT * FROM table_1 LEFT JOIN table_2 on table_2.id = table_1.id WHERE table_2.id IS NULL Read about LEFT JOINs in the