Is it me, or do the Joins in Query a Query not work properly?

I'm trying to import data from a text file and put it into a SQL Server 7
database, but I only want records which aren't already there... simple
enough right?

I get the text file via a query;
<CFQuery datasource="TextImport" name="TextImport">
        select Field1, Field2, Field3
        from myFile.txt
</cfquery>
Then all of the data in the SQL table
<CFQuery datasource="SQLdata" name="SQLdata">
        select Field1, Field2, Field3
        from myTable
</cfquery>

Then I try the join
<cfquery dbtype="query" name="JoinQuery">
        select TextImport.Field1 as Field1, TextImport.Field2 as Field2,
TextImport.Field3 as Field3
        from TextImport left outer join SQLdata on TextImport.Field1=SQLdata.Field1
        where TextImport.Field1 != SQLdata.Field1
</cfquery>

I know that Query a Query doesn't understand NULLs, so I'm assuming the
SQLdata.Field1 won't be NULL but will be empty

The problem is that it returns all records and not just the ones that are
missing

Anyone else have a similar problem and know the solution - I'm tearing what
little hair I have left out!

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to