Páginas

Google
 

segunda-feira, 30 de junho de 2008

corrigindo...

update testinventarioitens a set
a.qtdcontada = (select sum(b.diferenca)
from testinventarioitens b
where b.empresa = a.empresa
and (b.lote >= '0013' and
b.lote <= '0014')
and b.produto = a.produto
)
where (a.empresa = '01') and
(a.lote = '0015');



update testinventarioitens inv
set inv.qtdcontada = inv.estoque
where inv.qtdcontada is null
and inv.empresa = '01'
and inv.lote = '0015';



update testinventarioitens i
set i.diferenca = i.qtdcontada - i.estoque
where i.empresa = '01'
and i.lote = '0015'
and i.qtdcontada is not null;

Nenhum comentário: