Title: Message
It doesn't look like you are using the output query "group" attribute correctly.  Try using cfloop as Ryan mentioned.  Something like this:
 
<cfquery name="getTables" datasource="portfolio">
SELECT thisTable
FROM tables
</cfquery>
 
<cfquery name="getIDs" datasource="portfolio">
SELECT newPK, oldPK
FROM oldAndNewIDs
</cfquery> 
 
<cftransaction action="">
<cfloop query="getTables">
 
 <cfoutput query="getIDs">
  <cfquery name="update" datasource="portfolio">
  UPDATE #getTables.thisTable#
  SET studentID = #getIDs.newPK#
  WHERE studentID = #getIDs.oldPK#
  <cfquery>
 </cfoutput>
</cfloop>
</cftransaction>
 
Randy Ellis
City of Overland Park
Senior Programmer Analyst
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adaryl Wakefield
Sent: Wednesday, April 07, 2004 2:54 PM
To: [EMAIL PROTECTED]
Subject: [KCFusion] system migration

I have to update the primary keys of every tuple in 20 different tables.
I was thinking I could get this done by having a table of all the tables that need up dating and having a table of the old primary keys with the new values.
I'd loop over the tables table then nested in that loop id loop over the table with the new values. So far no luck.
 
<cfquery name="getIDs" datasource="portfolio">
SELECT newPK, oldPK
FROM oldAndNewIDs
</cfquery>
 
 
<cfquery name="getTables" datasource="portfolio">
SELECT *
FROM tables
</cfquery>
 
<cftransaction action="">
<cfoutput query="getTables" group="id">
 <cfoutput query="getIDs">
  <cfquery name="update" datasource="portfolio">
  UPDATE #getTables.thisTable#
  SET studentID = #getIDs.newPK
  WHERE studentID = #getIDs.oldPK
<cfquery>
 </cfoutput>
</cfoutput>
</cftransaction>
 
Im kind of at a loss on how to group this statement right.
 
Adaryl "Did you reboot?" Wakefield
Aviator by passion
Programmer by sheer force of will

Reply via email to