List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:July 9 1999 4:50am
Subject:Re: UPDATE with JOIN
View as plain text  
Para-dox wrote:
> 
> (respond to paradox@stripped)
> 
> I need to be able to update one table based on a JOIN with another table,
> can this be done? REPLACE can't work since it deletes the row which contains
> 30+ other columns of data, only one column needs to be updated, based on a
> sum() from another table. I *NEED* this or my project goes to hell, and I
> switch to another SQL server. I know MS access supports a statement like
> this:
> 
> UPDATE INVOICES LEFT JOIN ITMSOLD ON INVOICES.INVNUM = ITMSOLD.INVNUM SET
> INVOICES.SUBTOTAL = Sum(ITMSOLD.EXTPRC);
> 
> Does MySQL support anything similar?
> 
> Regards, Dave
> 

I think the only way around it is to use a temporary table, then REPLACE
INTO ... SELECT will work.

-- 
Sasha Pachev
http://www.sashanet.com
Thread
UPDATE with JOINPara-dox9 Jul
  • Re: UPDATE with JOINSasha Pachev9 Jul
  • Re: UPDATE with JOINPara-dox9 Jul
  • UPDATE with JOINMichael Widenius29 Jul