pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: yusuf0478@netscape.net
Cc: pgsql-sql@postgresql.org
Subject: Re: Query Help
Date: Thu, 23 Oct 2003 12:34:13 -0600 (MDT)
Message-ID: <Pine.LNX.4.33.0310231232480.21690-100000@css120.ihs.com> (raw)
In-Reply-To: <7E2F242E.303998B7.037EC703@netscape.net>

On Thu, 23 Oct 2003 yusuf0478@netscape.net wrote:

> I'm interested in finding the minimim A.id such that the following holds:
> 
> select A.charge
>     , B.user_id
>     , C.employee_id
> from A
> inner join B using (user_id)
> inner join C using (employee_id)
> 
> except
> 
> select X.charge
>     , Y.user_id
>     , Z.employee_id
> from X
> inner join Y using (user_id)
> inner join Z using (employee_id)
> 
> --
> 
> I can't do the following, since the number of selected columns have to match: 
> 
> select A.id 
>     , A.charge
>     , B.user_id
>     , C.employee_id
> from A
> inner join B using (user_id)
> inner join C using (employee_id)
> 
> except
> 
> select X.charge
>     , Y.user_id
>     , Z.employee_id
> from X
> inner join Y using (user_id)
> inner join Z using (employee_id)

Maybe you can add a dummy field in the second half like this:

except

 select -1 
     , X.charge
     , Y.user_id
     , Z.employee_id

???




view thread (8+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0310231232480.21690-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0310231232480.21690-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0310231232480.21690-100000@css120.ihs.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: scott.marlowe@ihs.com, yusuf0478@netscape.net
  Subject: Re: Query Help
  In-Reply-To: <Pine.LNX.4.33.0310231232480.21690-100000@css120.ihs.com>
  References: <7E2F242E.303998B7.037EC703@netscape.net> <Pine.LNX.4.33.0310231232480.21690-100000@css120.ihs.com>

* 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