You are here: Re: Not Exists joining 2 tables « MsSQL Server « IT news, forums, messages
Re: Not Exists joining 2 tables

Posted by Ed Murphy on 11/28/07 05:46

creedp.71@gmail.com wrote:

> Consider this alternative and let me know if I screw this one up,
> after all, it's getting late, and I'm still at work :) .....
>
> SELECT company.code, company.name, company.type,
> contacts.fullname
> FROM company Left JOIN
> contacts ON company.code = contacts.code
> AND (company.type in ('C', 'R')) and (contacts.fullname =
> 'Accounting')
> WHERE contacts.code IS NULL
> order by company.code

I think this would work (except in the unlikely case that
contacts.code is nullable, in which case it might return
some data that it shouldn't). But NOT EXISTS has the strong
advantage of letting you say what you mean.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация