update itemnfeprodutoef set quantidade=0.001 where autoid in (select i.autoid from itemnfeprodutoef i inner join nfeef n on n.autoid = i.nfeitem where dataentrada >= '2010-05-01' and dataentrada <= '2010-05-31' and i.quantidade=0 and i.autoid = itemnfeprodutoef.autoid) update itemnfsprodutoef set quantidade=0.001 where autoid in (select i.autoid from itemnfsprodutoef i inner join nfsef n on n.autoid = i.nfsitem where dataemissao >= '2010-08-01' and dataemissao <= '2010-08-31' and i.quantidade=0 and i.autoid = itemnfsprodutoef.autoid)