Re: Need Help for select

From: Masaru Sugawara <rk73(at)sea(dot)plala(dot)or(dot)jp>
To: Andre Schubert <andre(at)km3(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Need Help for select
Date: 2002-08-14 22:57:31
Message-ID: 20020815072303.C857.RK73@sea.plala.or.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 14 Aug 2002 16:04:21 +0200
Andre Schubert <andre(at)km3(dot)de> wrote:

> >
> >
> > If this mention implies that the tuple of (1, 1) in the c is supposed
^^
b
> > to take precedence over that of (2, 1),
>
> I want to compare if a tuple in c exist in b for each c.d_id and b.a_id.
> In c exists 3 tuples: (1,2), (3,4), (5)
> and want to find these tuples in b.

I were able to catch what conditions join b to c. I try to think again.

>
> select a.name,d.name from a,b,c,d where "tuple found in b" = "tuple found in c" and b.a_id = a.id and c.d_id = d.id
>
> My english is not so good, but i hope you understand what i want to do.
>
> Thanks in advance
>
> >
> >
> > SELECT a.name, d.name
> > FROM (SELECT DISTINCT min(b.a_id) AS a_id, c.d_id
> > FROM b, c
> > WHERE b.c_id = c.b_id
> > GROUP BY b.c_id, c.d_id
> > ) AS t,
> > a,
> > d
> > WHERE a.id = t.a_id
> > AND d.id = t.d_id
> >
> >

Regards,
Masaru Sugawara

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-08-15 02:13:27 DISTINCT peformance differences
Previous Message Bruce Momjian 2002-08-14 18:34:40 Re: [SQL] 16 parameter limit