I have managed to merge records from three tables into one table. But I made a (what I thought was minor!)goof. I crossed my columns so that data for the Country field witn went into the Zip_Code field. So, now, I am trying to move the data from the Zip_Code field into the Country. It would have been as easy as changing the field name but half the records are correct and half are not for the Zip_Code field!
So how do I move data from one field into another for the same table?
Here is the code I am using...
<CFQUERY NAME="Info_list" DATASOURCE="#DSN#">
InfoID_PK, Info_Zip, Info_Country
FROM Info_list
WHERE (InfoID_PK < 447)
</CFQUERY>
<cfloop query="Info_list">
<CFQUERY NAME="Info_Update" DATASOURCE="#DSN#">
UPDATE Info_list
SET Info_Country = '#Info_Zip#'
</CFQUERY>
</cfloop>
I have checked my first query and I get the proper output..however when I run the second query with the loop, it just picks the first value and inserts it right through the Info_Country field of all the records if the table..it does not even follow the restriction of the earlier key and update only data for InfoID_PK less than 47
Any suggestions would be deeply appreciated!
So how do I move data from one field into another for the same table?
Here is the code I am using...
<CFQUERY NAME="Info_list" DATASOURCE="#DSN#">
InfoID_PK, Info_Zip, Info_Country
FROM Info_list
WHERE (InfoID_PK < 447)
</CFQUERY>
<cfloop query="Info_list">
<CFQUERY NAME="Info_Update" DATASOURCE="#DSN#">
UPDATE Info_list
SET Info_Country = '#Info_Zip#'
</CFQUERY>
</cfloop>
I have checked my first query and I get the proper output..however when I run the second query with the loop, it just picks the first value and inserts it right through the Info_Country field of all the records if the table..it does not even follow the restriction of the earlier key and update only data for InfoID_PK less than 47
Any suggestions would be deeply appreciated!