pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: patrick.jacquot@anpe.fr
To: pgsql-sql@postgresql.org
Subject: Re: Query Help
Date: Thu, 28 Dec 2000 10:54:43 +0100
Message-ID: <3A4B0DE2.A93C02AD@anpe.fr> (raw)
References: <5.0.2.1.2.20001227111807.074dd2d0@pop.mindspring.com>

"Brian C. Doyle" wrote:

> What do I have to do a query where information in table1 is not in table2
>
> I am looking for something like
>
> Select table1.firstname where table1.firstname is not in table2.firstname
> and table2.date='yesterday'
>
> I tried
> Select table1.firstname where table1.firstname != table2.firstname and
> table2.date='yesterday'
>
> and that did not work just listed everyone....

imho the most natrural way for what you need seems to be :

select  whatyouwant from table1 where not exists
    select * from table2 where table2.firstname = table1.firstname and
table2.date='yesterday';

hoping that helps
P. Jacquot




view thread (8+ messages)  latest in thread

Message-ID: <3A4B0DE2.A93C02AD@anpe.fr>
Permalink:  ../3A4B0DE2.A93C02AD@anpe.fr/
Also on:    postgresql.org/message-id/3A4B0DE2.A93C02AD@anpe.fr

 · 

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: patrick.jacquot@anpe.fr
  Subject: Re: Query Help
  In-Reply-To: <3A4B0DE2.A93C02AD@anpe.fr>

* 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