Just a quick glance but could you do something like:

Insert into properties(mls_number)
Values(select mls_number from table where whatever)

I think that's the syntac but you may not need the values piece. I can't
remember off hand but I've done combined insert/select statements like
that before and it basically inserts a row for each row it selects. Does
that make sense? The other thing you could do is a Query of a query
before you do the loop and weed it out so you only have the criteria you
want coming into the loop. Hope that helps.

John

-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 05, 2008 11:57 AM
To: CF-Talk
Subject: RE: Anything wrong with this code?

Kind of a dumb thing I'm trying to do...trying to combine
an insert statement with a where clause.

I think I need another approach.

Back to the drawing board...

Rick


> -----Original Message-----
> From: Rick Faircloth [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2008 11:40 AM
> To: CF-Talk
> Subject: Anything wrong with this code?
> 
> (Simplified version... MySQL 5)
> 
> <cfloop query='get_hmls_commercial_data'>
> 
> <cfquery name='insert_data' datasource='xxxxx'
> 
>      insert into properties
> 
>             (mls_number)
> 
>      values (<cfqueryparam cfsqltype='cf_sql_varchar'
> value='#get_hmls_commercial_data.mls_number#_h' null='#not
len(trim(mls_number))#'>)
> 
>       where '#get_hmls_commercial_data.mls_number#_h' not in
>             (select mls_number from properties)
> 
> </cfquery>
> 
> </cfloop>
> 
> I'm getting this error upon execution of the template...
> 
> Error Executing Database Query.
> You have an error in your SQL syntax;
> check the manual that corresponds to your MySQL server version
> for the right syntax to use near
> 'where '39438_h' not exists in (select mls_number from prope' at line
32
> 
> ???
> 
> Thanks,
> 
> 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:306897
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