Re: Item in two db tables
| From: | Steve Werby | Date: | Wed, 04 Apr 2001 16:05:11 +0000 |
| Subject: | Re: Item in two db tables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-47084@lists.php.net to get a copy of this message | ||
"bill" <bill@billtron.com> 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 manual.
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/