Re: Not Exists joining 2 tables
- From: Ed Murphy <emurphy42@xxxxxxxxxxxx>
- Date: Tue, 27 Nov 2007 21:46:39 -0800
creedp.71@xxxxxxxxx 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.
.
- Follow-Ups:
- Re: Not Exists joining 2 tables
- From: jhofmeyr
- Re: Not Exists joining 2 tables
- References:
- Re: Not Exists joining 2 tables
- From: creedp . 71
- Re: Not Exists joining 2 tables
- Prev by Date: Re: ORDER BY AND GROUP BY CLAUSE
- Next by Date: Re: Data insertion too too slow...
- Previous by thread: Re: Not Exists joining 2 tables
- Next by thread: Re: Not Exists joining 2 tables
- Index(es):