En realidad no es que devuelve un valor verdadero, puedes ponerle un 0 un
'Hola' un campo del archivo lo que quieras.
Lo que chequea el exists es que existan filas en la subconsulta, y solo
existiran filas si se encuentra un registro para la clausula del where...
aunque para que funcione la consulta deberia ser asi,
update bibli2.fichero
set campo4 = 'PRUEBA'
where
bibli2.fichero.campo4 = 'PRUIYD' and
exists
( select 1
FROM
bibli1.fichero
where
bibli2.fichero.campo1 = bibli1.fichero.campo1 and
bibli2.fichero.campo2 = bibli1.fichero.campo2 and
bibli2.fichero.campo3= bibli1.fichero.campo3)
----- Original Message -----
From: "Pinedo Pedro" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, January 24, 2005 3:19 AM
Subject: RE: Optimizar sql
Creo que con esta variante, me actualiza todos los registros, porque el
exists devuelve el valor verdadero siempre.
Pedro Pinedo Hernandez
Analista-Programador
Grupo Amcor Flexibles Hispania S.L.
Planta: Tobepal Logro�o
Departamento de Inform�tica / IT Department
tfno.:+34 941 28 60 90 - 941 03 01 39
fax: +34 941 20 75 43
26006 Logro�o
Spain
[EMAIL PROTECTED]
(quitar nospam del dominio, para enviar)
-----Mensaje original-----
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] En nombre de Dario Gabriel
Ivan Heinze
Enviado el: viernes, 21 de enero de 2005 20:56
Para: [email protected]
Asunto: Re: Optimizar sql
otra variante ...
update bibli2.fichero
set campo4 = 'PRUEBA'
where
exists
( select 1
FROM
bibli2.fichero,
bibli1.fichero
where
bibli1.fichero.campo1 = bibli2.fichero.campo1 and
bibli2.fichero.campo2 = bibli1.fichero.campo2 and
bibli2.fichero.campo3= bibli1.fichero.campo3 and
bibli2.fichero.campo4 = 'PRUIYD')
----- Original Message -----
From: "Llobet Galtes, Joan" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, January 21, 2005 8:08 AM
Subject: RE: Optimizar sql
Prueba lo siguiente:
update bibli2.fichero
set campo4 = 'PRUEBA'
where
(campo1 || campo2 || campo3) in
( select (bibli2.fichero.campo1 || bibli2.fichero.campo2 ||
bibli2.fichero.campo3)
FROM
bibli2.fichero,
bibli1.fichero
where
bibli1.fichero.campo1 = bibli2.fichero.campo1 and
bibli2.fichero.campo2 = bibli1.fichero.campo2 and
bibli2.fichero.campo3= bibli1.fichero.campo3 and
bibli2.fichero.campo4 = 'PRUIYD')
Joan
_____
De: Pinedo Pedro [mailto:[EMAIL PROTECTED]
Enviado el: viernes 21 de enero de 2005 10:44
Para: [email protected]
Asunto: Optimizar sql
Soy un "tomate" con esto del sql. He montado esta sentencia para
actualizar un campo de registros coincidentes entre dos ficheros de
distintas biblioteca, pero el rendimiento es penoso.
�Alguien me puede ayudar?
update bibli2.fichero
set campo4 = 'PRUEBA'
where
campo1 in( select bibli2.fichero.campo1
FROM
bibli2.fichero,
bibli1.fichero
where
bibli1.fichero.campo1 = bibli2.fichero.campo1 and
bibli2.fichero.campo2 = bibli1.fichero.campo2 and
bibli2.fichero.campo3= bibli1.fichero.campo3 and
bibli2.fichero.campo4 = 'PRUIYD')
and
campo2 in( select bibli2.fichero.campo2
FROM
bibli2.fichero,
bibli1.fichero
where
bibli1.fichero.campo1 = bibli2.fichero.campo1 and
bibli2.fichero.campo2 = bibli1.fichero.campo2 and
bibli2.fichero.campo3= bibli1.fichero.campo3 and
bibli2.fichero.campo4 = 'PRUIYD')
and
campo3 in( select bibli2.fichero.campo3
FROM
bibli2.fichero,
bibli1.fichero
where
bibli1.fichero.campo1 = bibli2.fichero.campo1 and
bibli2.fichero.campo2 = bibli1.fichero.campo2 and
bibli2.fichero.campo3= bibli1.fichero.campo3 and
bibli2.fichero.campo4 = 'PRUIYD')
Pedro Pinedo Hernandez
Analista-Programador
Grupo Amcor Flexibles Hispania S.L.
Planta: Tobepal Logro�o
Departamento de Inform�tica / IT Department
tfno.:+34 941 28 60 90 - 941 03 01 39
fax: +34 941 20 75 43
26006 Logro�o
Spain
[EMAIL PROTECTED]
(quitar nospam del dominio, para enviar)
_______________________________________________________
AMCOR FLEXIBLES - LEADING THROUGH INNOVATION
_______________________________________________________
CAUTION - This message may contain privileged and confidential
information intended only for the use of the addressee named above. If
you are not the intended recipient of this message you are hereby
notified that any use, dissemination, distribution or reproduction of
this message is prohibited. If you have received this message in error
please notify AMCOR FLEXIBLES immediately. Any views expressed in this
message are those of the individual sender and may not necessarily
reflect the views of AMCOR FLEXIBLES.
_____________________________________________________
Forum.HELP400 es un servicio m�s de NEWS/400.
� Publicaciones Help400, S.L. - Todos los derechos reservados
http://www.help400.es
_____________________________________________________
Para darte de baja, env�a el mensaje resultante de pulsar
mailto:[EMAIL PROTECTED]
_______________________________________________________
AMCOR FLEXIBLES - LEADING THROUGH INNOVATION
_______________________________________________________
CAUTION - This message may contain privileged and confidential
information intended only for the use of the addressee named above. If
you are not the intended recipient of this message you are hereby
notified that any use, dissemination, distribution or reproduction of
this message is prohibited. If you have received this message in error
please notify AMCOR FLEXIBLES immediately. Any views expressed in this
message are those of the individual sender and may not necessarily
reflect the views of AMCOR FLEXIBLES.
_____________________________________________________
Forum.HELP400 es un servicio m�s de NEWS/400.
� Publicaciones Help400, S.L. - Todos los derechos reservados
http://www.help400.es
_____________________________________________________
Para darte de baja, env�a el mensaje resultante de pulsar
mailto:[EMAIL PROTECTED]
_____________________________________________________
Forum.HELP400 es un servicio m�s de NEWS/400.
� Publicaciones Help400, S.L. - Todos los derechos reservados
http://www.help400.es
_____________________________________________________
Para darte de baja, env�a el mensaje resultante de pulsar
mailto:[EMAIL PROTECTED]