RE: query of two tables returns too many rows, many more than the two tables contain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: Chip Wiegand [mailto:chip.wiegand@xxxxxxxxxx] 
Sent: Thursday, November 11, 2004 3:28 PM
To: PHP DB
Subject:  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.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux