Skip to main content
February 26, 2013
Question

Updating table with query of 2 other tables?

  • February 26, 2013
  • 1 reply
  • 1232 views

Greetings

I apologize in advance if this seems too easy to do- but I am missing something.

I have 8000 records in an Access DB (I know- it's going into SQL soon) in which all  the departmental office IDs need to be updated.

The column in the main table  is named "q_office_ID".

The user table includes  user_ID &  office_ID.

The office table also includes office_ID.

This UPDATE sets all the values to the number 10?:

<cfquery name="update" datasource="#Request.BaseDSN#">

SELECT     queue_ID, q_user_ID, user_ID, office_ID

FROM     main_helpdesk, lookup_user

WHERE  q_user_ID = user_ID

</cfquery>

<cfloop query="update"><cfquery name="updatedata" datasource="#Request.BaseDSN#">

UPDATE main_helpdesk

SET q_office_ID = #office_ID#

</cfquery></cfloop>

I know there is something obviously wrong with the update- any help would be greatly appreciated.

Thank You

This topic has been closed for replies.

1 reply

Inspiring
February 26, 2013

The lack of a where clause is pretty significant.    

February 26, 2013

Dan

Whether I missed something as obvious as that or I already tried the "where" clause I guess is not clear- but I only asked because I tried it many different ways with no good result.