pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Barry Baldwin <bbaldwin@indyme.com>
To: PGSQL-SQL <pgsql-sql@postgreSQL.org>
Subject: MINUS emulation?
Date: Sun, 19 Dec 1999 17:47:06 -0800
Message-ID: <319A9588FB5ED2119FAC00A0C912E3292785C0@INDYMEEXCH> (raw)

Hi all,

I'm trying to do a query that returns all the records in one  table unless
they exist in another table.

For example the first query I tried was this;

Select  A.field_id, A.data, B.field_id, B.data
from table_1 A, table_2 B
where  A.field_id <> B.field_id;

This query resulted in no records being returned, I believe this is because
Table_2 is empty.

I then tried :

Select field_id, data 
from table_1
minus
Select field_id, data
from table_2;

This didn't work because the Minus directive isn't recognized.

Does anyone have a suggestion on how I might accomplish this?

TIA,

Barry




view thread (3+ messages)  latest in thread

Message-ID: <319A9588FB5ED2119FAC00A0C912E3292785C0@INDYMEEXCH>
Permalink:  ../319A9588FB5ED2119FAC00A0C912E3292785C0@INDYMEEXCH/
Also on:    postgresql.org/message-id/319A9588FB5ED2119FAC00A0C912E3292785C0@INDYMEEXCH

 · 

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: bbaldwin@indyme.com
  Subject: Re: MINUS emulation?
  In-Reply-To: <319A9588FB5ED2119FAC00A0C912E3292785C0@INDYMEEXCH>
  References: <319A9588FB5ED2119FAC00A0C912E3292785C0@INDYMEEXCH>

* 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