homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

can I do a join that shows what is 'not' in the other table?
mysql, query, join

Msg#: 4234625 posted 7:12 pm on Nov 24, 2010 (gmt 0)

I have two tables connected by 'pid'.
When setting a product up, there is an option to set a tax table. If none is set, the table 'tax' does not get an entry.

Can I use a join to show all pids in 'products' that are not in 'tax', or do I have to build a PHP routine to sift this out?




WebmasterWorld Administrator lifeinasia us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

Msg#: 4234625 posted 7:31 pm on Nov 24, 2010 (gmt 0)

Yup- LEFT OUTER JOIN is your friend!

SELECT Table1.pid
FROM Table1 LEFT OUTER JOIN Table2 ON Table1.pid=Table2.pid
WHERE Table2.tax IS NULL


Msg#: 4234625 posted 1:03 am on Nov 25, 2010 (gmt 0)

awesome! Thanks so much!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved