I think this is the fastest way you can do it in mssql

SELECT  
        a,b,c,d
FROM
        tbl1
WHERE
        tbl1.a = [passed in a]
AND     NOT EXISTS (
                        SELECT  'x'
                        FROM            tbl2
                        WHERE           tbl2.a = tbl1.a
                        AND             tbl2.b = tbl1.b
                        AND             tbl2.c = tbl1.c
                        AND             tbl2.d = tbl1.d
        )

-----Original Message-----
From: Tim Do [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 09, 2007 2:37 PM
To: CF-Talk
Subject: OT: sql not in

how do I return values from tbl1 where values are NOT in tbl2.  

 

tbl1

a,b,c,d

 

tbl2

a,b,c,d

 

only a is passed in.  b,c,d are unique.  tbls do not have identity
fields.

 

thanks,

tim

 

 

 

 







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285986
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