macromedia.coldfusion.database_access
[Top] [All Lists]

Re: Update table 1 with data from Table 2?

Subject: Re: Update table 1 with data from Table 2?
From: "newportri" <webforumsuser@xxxxxxxxxxxxxx>
Date: Mon, 28 Jul 2008 18:27:09 +0000 (UTC)
Newsgroups: macromedia.coldfusion.database_access

Dan:

 Thanks- but I'm still getting syntax errors:

 <cfquery name="updatedata" datasource="somedatabase">
 UPDATE newtable
 FROM oldtable
 SET vendor_address1 = Street1,
     vendor_address2 = Street2,
     vendor_city = City,
        vendor_state = StateID,
        vendor_zip = Zip,
        vendor_zip4 = Zip4,
        vendor_tele = Phone,
        vendor_fax = Fax

  WHERE old_location_ID = PhysicalLocationID

 </cfquery>

 Wouldn't the values that I need to update all the records with need to be from 
a additional query (e.g. something like:

 <cfquery name="getdata" datasource="somedatabase">
 SELECT PhysicalLocationID, Street1, Street2, City, StateID, Zip, Zip4, Phone, 
Fax, old_location_ID
 FROM oldtable, newtable
 WHERE oldtable.PhysicalLocationID = newtable.old_location_ID
 </cfquery>

 <cfoutput query="getdata">


 <cfquery name="updatedata" datasource="vendors.mdb">
 UPDATE vendor_new
 SET vendor_address1 = '#Street1#', etc.?

 Sorry- but this is the last "hurdle" I need to jump to bring this whole thing 
together...


 Thanks!

 newportri


<Prev in Thread] Current Thread [Next in Thread>