Re: [pgsql-ayuda] join

From: Jesus Aneiros <aneiros(at)jagua(dot)cfg(dot)sld(dot)cu>
To: pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx
Subject: Re: [pgsql-ayuda] join
Date: 2000-11-18 17:06:00
Message-ID: Pine.LNX.4.10.10011181205290.11666-100000@jagua.cfg.sld.cu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Sat, 18 Nov 2000, Jesus Aneiros wrote:

> Con un OUTER JOIN se resolveria
>
> SELECT t1.c1, t1.c2, t2.c2
> FROM t1 LEFT JOIN t2
> ON t1.c3 = t2.c1;
>
> Pero me temo que PgSQL todavia no soporta este tipo de acoples.
>
> La siguiente UNION debe darte un resultado similar. (Asumiento que c1 es
> llave).
>
> SELECT t1.c1, t1.c2, t2.c2
> FROM t1, t2
> WHERE t1.c3 = t2.c1
> UNION
> SELECT c1, c2, ' '
> FROM t1;

Lo de abajo creo que sobra.

> WHERE c1 NOT IN (SELECT c1
> FROM t1, t2
> WHERE t1.c3 = t2.c1);
>
>
> On Tue, 14 Nov 2000, OCR wrote:
>
> > tengo las tablas
> > t1 t2
> > c1 | c2 | c3 c1 | c2
> > oscar |cano | 1 1 | doctor
> > juan |algo | 3 2 | maestro
> > paco |xx | 3 | licenciado
> >
> > si hago:
> > select t1.c1,t1.c2,t2.c2 from t1,t2 where t1.c3=t2.c1
> > me despliega:
> >
> > oscar |cano | doctor
> > juan |algo | licenciado
> >
> > pero quiero que me despliege:
> >
> > oscar |cano | doctor
> > juan |algo | licenciado
> > paco |xx |
> >
> > como hago esto?
> > --------- Pie de mensaje -------------------------------------------
> > Archivo historico: http://tlali.iztacala.unam.mx/maillist/pgsql-ayuda
> > Cancelar inscripcion:
> > mail to: majordomo(at)tlali(dot)iztacala(dot)unam(dot)mx
> > text : unsubscribe pgsql-ayuda
> >
>
> --
> Jesus Aneiros Sosa
> mailto:aneiros(at)jagua(dot)cfg(dot)sld(dot)cu
> http://jagua.cfg.sld.cu/~aneiros
>
> --------- Pie de mensaje -------------------------------------------
> Archivo historico: http://tlali.iztacala.unam.mx/maillist/pgsql-ayuda
> Cancelar inscripcion:
> mail to: majordomo(at)tlali(dot)iztacala(dot)unam(dot)mx
> text : unsubscribe pgsql-ayuda
>

--
Jesus Aneiros Sosa
mailto:aneiros(at)jagua(dot)cfg(dot)sld(dot)cu
http://jagua.cfg.sld.cu/~aneiros

--------- Pie de mensaje -------------------------------------------
Archivo historico: http://tlali.iztacala.unam.mx/maillist/pgsql-ayuda
Cancelar inscripcion:
mail to: majordomo(at)tlali(dot)iztacala(dot)unam(dot)mx
text : unsubscribe pgsql-ayuda

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Adrian Galindo 2000-11-18 18:12:14 Re: [pgsql-ayuda] PHP en Mexico
Previous Message Jesus Aneiros 2000-11-18 12:47:01 Re: [pgsql-ayuda] join