I have a perplexing problem that I am finding difficult to work through.
I have 2 tables in my MYSQL database containing similar data. I'll outline just the pertinent information.
Table1 - ezpay_Usage Columns: ticket_ID date_opened date_closed - No data in this column yet
Table2 - Closed_Tickets Columns: ticket_ID date_opened date_closed - Has all the data
Table2 has data in the column "date_closed". We just changed out DB Structure and added the same column to Table1 (Currently has no data in that column though). Both columns will reference the same data and going forward will be updated in unison.
My questions is, how can I update all the existing records in Table1 with the data for the date_closed column by comparing it to the data in Table2.
I was thinking perhaps this way?:
First, Query The Table with the Data in question
<cfquery name="source_table" datasource="#datasource#">
select *
from closed_tickets
</cfquery>'
Second, query the table I want to update
<cfquery name="tableToBeModified" datasource="#datasource#">
select *
from ezpay_usage
</cfquery>
Then, run an update query on the table I want to update
<cfquery name="update" query="#datasource#">
update ezpay_usage
set date_closed = #source_table.closed_date#
where ticket_id = #source_table.tciket_id#
</cfquery>
Anyone have any suggestions for me? Thanks.