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"];
    $thisitem=$row["item"];
    $ckresult=mysql_query("SELECT id FROM table2 WHERE id=$thisid");
    if (!mysql_num_rows($ckresult)) {
        echo "$thisitem using id $thisid is in table 1 but does not
appear in table 2<BR>";
    } // end if

} // end while



kind regards,

bill hollett


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to