pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andre Schubert <andre@km3.de>
To: Masaru Sugawara <rk73@sea.plala.or.jp>
Cc: pgsql-sql@postgresql.org
Subject: Re: Need Help for select
Date: Wed, 14 Aug 2002 16:04:21 +0200
Message-ID: <20020814160421.2c75727e.andre@km3.de> (raw)
In-Reply-To: <20020814201310.C84C.RK73@sea.plala.or.jp>
References: <20020812151148.26186.qmail@web40013.mail.yahoo.com>
	<20020814091053.1d3138db.andre@km3.de>
	<20020814201310.C84C.RK73@sea.plala.or.jp>

On Wed, 14 Aug 2002 21:57:02 +0900
"Masaru Sugawara" <rk73@sea.plala.or.jp> wrote:

> On Wed, 14 Aug 2002 09:10:53 +0200
> Andre Schubert <andre@km3.de> wrote:
> 
> > The ride side as follows.
> > Table d contains information about subitems.
> > Table c holds information about subitems and items of type bar.
> > Each subitem can have 0..n items bar selected.
> > 
> > What i want is that a subitem is only activated for a foo item if
> > the foo-item has exactly selected the same bar items selected as
> > as the relation between table c and d.
> > 
> > Example 1:
> > The foo-item A_Name1 has selected the bar-items 1 and 2.
> > The subitem D_Name1 is only activated for a foo-item if that foo-item
> > has selected the bar-items 1 and 2, this happens for A_Name1.
> > 
> 
> 
> If this mention implies that the tuple of (1, 1) in the c is supposed
> 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.

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
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly



view thread (8+ messages)  latest in thread

Message-ID: <20020814160421.2c75727e.andre@km3.de>
Permalink:  ../20020814160421.2c75727e.andre@km3.de/
Also on:    postgresql.org/message-id/20020814160421.2c75727e.andre@km3.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andre@km3.de, rk73@sea.plala.or.jp
  Subject: Re: Need Help for select
  In-Reply-To: <20020814160421.2c75727e.andre@km3.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox