When I have done this, I used a NOT EXISTS, so something like this random
example I just pulled from Google:

http://archives.postgresql.org/pgsql-general/2003-06/msg01683.php

On Fri, May 16, 2008 at 9:40 AM, Rick Faircloth <[EMAIL PROTECTED]>
wrote:

> I don't remember ever running a query like this one, so I'm
> not sure it's even a valid approach.
>
> But, should this run?  Or do I need to run a separate query
> to the existing photo_filenames from hmls_photos to use as a variable?
>
> <cfquery name="insert_photo" datasource="c21ar">
>
>     insert into hmls_photos
>                 (photo_filename, photo_mls_number)
>          values (<cfqueryparam cfsqltype="cf_sql_varchar" value="#
> photolist.name#">,
>                  <cfqueryparam cfsqltype="cf_sql_varchar"
> value="#listfirst(photolist.name,
> '_')#">)
>           where photolist.name not in
>                 (select photo_filename from hmls_photos)
>
> </cfquery>
>
> I'm just checking the table to insure that I'm not already inserting a
> photo with
> a filename already in the table.
>
> Rick
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

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

Reply via email to