Re: Query Help - Mailing list pgsql-sql

From patrick.jacquot@anpe.fr
Subject Re: Query Help
Date
Msg-id 3A4B0DE2.A93C02AD@anpe.fr
Whole thread Raw
In response to Query Help  ("Brian C. Doyle" <bcdoyle@mindspring.com>)
List pgsql-sql
"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



pgsql-sql by date:

Previous
From: Yury Don
Date:
Subject: Re: Query Help
Next
From: Jens Hartwig
Date:
Subject: Strange Execution-Plan for NOT EXISTS