fixes bug#9842

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@73958 d1611594-4594-4d17-8e1d-87c2c4800839
master
gleimar 2017-09-19 01:16:23 +00:00
parent e6a64ba942
commit 9dc3ca0443
1 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,9 @@
update
esquema_corrida ec
set ec.ROLOPERATIVO_ID = (select ec2.ROLOPERATIVO2_ID from esquema_corrida ec2 where ec2.activo =1 and ec2.NUMCORRIDAPISOEXTRA= ec.numcorrida and ec2.indpisoextra =1)
where
(ec.NUMCORRIDAPISOEXTRA is null)
and exists (select * from esquema_corrida ec3 where ec3.activo = 1 and ec3.NUMCORRIDAPISOEXTRA = ec.numcorrida)
and ec.ROLOPERATIVO_ID <> (select ec4.ROLOPERATIVO2_ID from esquema_corrida ec4 where ec4.activo =1 and ec4.NUMCORRIDAPISOEXTRA = ec.numcorrida )
and activo = 1;