RE: [PHP-DB] query of two tables returns too many rows, many more than the two tables contain
| From: | Norland, Martin | Date: | Thu, 11 Nov 2004 21:47:18 +0000 |
| Subject: | RE: [PHP-DB] query of two tables returns too many rows, many more than the two tables contain | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-37245@lists.php.net to get a copy of this message | ||
-----Original Message-----
From: Chip Wiegand [mailto:chip.wiegand@simrad.com]
Sent: Thursday, November 11, 2004 3:28 PM
To: PHP DB
Subject: [PHP-DB] query of two tables returns too many rows, many more
than the two tables contain
I have two tables I want to get out the rows that are different between
them.
<<snip>>
in these tables the dealers.account_no is the same data as the
blackgate_users.User_Name dealers.DealerName is the same data as the
blackgate_users.DealerName I just want the rows that are in the dealers
table but not in the blackgate_users table.
===================================
You want to do a join on the two tables, and make it conditional upon a
known failing value (e.g. if when they DO match up, blackgate_users
shouldn't be NULL - make that your condition). That will return just
the rows in the first table that don't have a match.
cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.