Here's what I'm trying to accomplish...it's relatively simple, or so I thought.
Got a temp table of data (hmls_commercial_temp). I want to transfer that data to the table, hmls_commercial. Before I transfer the records, I want to check and make sure a record for each row in hmls_commercial_temp doesn't already exist in the hmls_commercial table. This is a better approach than doing complete wipe of the data in the receiving table and just replacing all the records. That seems like a waste of time and resources. Suggestions? Thanks, Rick > -----Original Message----- > From: Phillip Vector [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 05, 2008 12:03 PM > To: CF-Talk > Subject: Re: Anything wrong with this code? > > What are you trying to do. I may be able to suggest an idea. > > On Thu, Jun 5, 2008 at 8:56 AM, Rick Faircloth <[EMAIL PROTECTED]> wrote: > > 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:306923 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

