9 lines
549 B
SQL
9 lines
549 B
SQL
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; |