"Mike Blezien" <[EMAIL PROTECTED]> wrote on 03/27/2006 03:39:15 PM:

> Hello,
> 
> I'm alittle unclear on how too update multiple tables. We have two 
> tables with 
> the same column name:
> account.state
> account_service.state
> 
> when we update the account table, we also need to update the 
account_service 
> table with the same value for the 'state' column. Can this be done with 
MySQL 
> 4.1.12. and what is the correct syntax?
> 
> 
> Thx's
> Mickalo 
> 

Are there any other fields that link those two tables?

If not, this may work.... It would have been much easier to answer if you 
had provided more information about your tables and how they relate to 
each other.

UPDATE account act
INNER JOIN account_service svc
        on act.state = svc.state
SET act.state = newvalue, svc.state = newvalue
WHERE svc.state = oldvalue;

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to