Re: como unir estas dos consultas
Hola esteban,
Espero te sea Ăștil el ejemplo:
DELIMITER $$
DROP PROCEDURE IF EXISTS `actualizar`$$
CREATE PROCEDURE `actualizar`(parametro varchar(45))
BEGIN
update tabla1 t1
inner join
(select t2.idtabla1, sum(t2.cantidad * t2.precio) as subtotal
from tabla2 t2
where t2.idtabla1 = parametro
group by t2.idtabla1
) sq on t1.idtabla1 = sq.idtabla1
set t1.subtotal = sq.subtotal;
END$$
DELIMITER ;
CALL actualizar('1');
Subject
Views
Written By
Posted
2855
December 16, 2010 03:46PM
Re: como unir estas dos consultas
801
December 16, 2010 05:36PM
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.