Jim,
Thank you, that worked perfectly.  Admittedly, I get confused by the LEFT/ON
attribs in queries. 


Thanks,
Mark

-----Original Message-----
From: Jim Wright [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 16, 2006 11:56 AM
To: CF-Talk
Subject: Re: SQL Problem

Mark Leder wrote:
> I'm stumped on this. How to I retrieve records that do not match (I'm 
> wanting to display orphaned Companies that are not associated with 
> Projects).  Tried <> and using NOT and NOT IN() without success.
>  
> SELECT C.company, C.companyID, C.companyCity, C.companyState,
C.companyZip,
> P.companyID   
> 
> FROM dbTable_Clients_Companies_List C, dbtable_Clients_Projects_List P
> 
> WHERE C.companyID <> P.companyID
> 
> ORDER BY C.company ASC
> 
> Thanks,
> Mark
>  
If there is no match, then the right side of that is going to be NULL, and
then the <> comparison will always resolve to FALSE.

Try this...

SELECT C.company, C.companyID, C.companyCity, C.companyState,
C.companyZip,P.companyID FROM dbTable_Clients_Companies_List C LEFT JOIN
dbtable_Clients_Projects_List P  ON C.companyID = P.companyID WHERE
P.companyID IS NULL ORDER BY C.company ASC



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:260698
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to