Re: [Pgsql-ayuda] update con el resultado de un select??

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: jose antonio leo <jaleo8(at)storelandia(dot)com>
Cc: pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx
Subject: Re: [Pgsql-ayuda] update con el resultado de un select??
Date: 2003-07-03 18:43:15
Message-ID: 20030703184315.GC14977@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Thu, Jul 03, 2003 at 08:37:28PM +0200, jose antonio leo wrote:

> necesito hacer un update con todos los campos que me devuelve un select.
> esto es posible?
> Es decir me gustaria hacer un update from t1 set tam='P' where
> cod_int=(select int_art from t2),

WHERE cod_int IN (select ...)

(es ineficiente en 7.3 y anteriores; mira en el FAQ para ver como se
resuelve eficientemente, usando EXISTS)

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Postgres is bloatware by design: it was built to house
PhD theses." (Joey Hellerstein, SIGMOD annual conference 2002)

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2003-07-03 18:44:49 Re: [Pgsql-ayuda] actualizar postgresql de 7.2.1 a 7.3.3
Previous Message Manuel Sugawara 2003-07-03 18:43:11 Re: [Pgsql-ayuda] actualizar postgresql de 7.2.1 a 7.3.3