MySQL Forums
Forum List  »  New in 4.1: Subqueries

Re: Problem with Nested Inserts
Posted by: Juan Javaloyes
Date: July 27, 2005 02:11PM

I solved my problem. Saw on other forums this solution (for oracle):

update prod_suc ps set (cantidad, stockini, precio_may1, precio_may2) =
(select stock, stock, preciom, preciom2 from prod_cant pc where ps.cod_prod = pc.codigo);

That solution didn't work for me in MySQL, there seems to be a problem with grouping updates on MySQL, so I did it manually for each row:

UPDATE prod_suc ps
SET cantidad = (SELECT stock FROM prod_cant pc WHERE ps.cod_prod = pc.codigo)

and so on for the rest of the rows... There's another way, or IS there a TO DO for MySQL?

Options: ReplyQuote


Subject
Views
Written By
Posted
6301
July 26, 2005 04:23PM
3466
July 26, 2005 06:59PM
3101
July 27, 2005 12:23PM
3766
July 27, 2005 01:21PM
Re: Problem with Nested Inserts
3370
July 27, 2005 02:11PM
3328
July 27, 2005 03:32PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.