Re: SELECT ... WHERE ... NOT IN (SELECT ...);

From: Yon Den Baguse Ngarso <yon(at)dugem(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SELECT ... WHERE ... NOT IN (SELECT ...);
Date: 2002-08-23 07:55:34
Message-ID: 20020823075534.689143959@sitemail.everyone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

That's way i'm confuse.
I'm using postgresql-7.1.3

I did the same action like you do.
Am i missing something?

TIA,
Yon

--- Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>Yon Den Baguse Ngarso <yon(at)dugem(dot)com> writes:
>> I'm confused, the result should not 0 rows, right?
>
>Not what I get:
>
>regression=# create table tbl1(eventid int);
>CREATE TABLE
>-- load data
>regression=# SELECT eventid FROM tbl1;
> eventid
>---------
> 119064
> 119064
> 60116
> 16082
> 16082
> 16303
> 16082
> 92628
> 92628
> 60083
>(10 rows)
>
>regression=# create table tbl2(eventid int);
>CREATE TABLE
>-- load data
>regression=# SELECT eventid FROM tbl2;
> eventid
>---------
> 123989
> 123989
> 123989
> 16134
> 16134
> 16368
> 16134
> 92685
> 92685
> 60115
>(10 rows)
>
>regression=# SELECT eventid FROM tbl1 WHERE eventid NOT IN (SELECT eventid FROM tbl2);
> eventid
>---------
> 119064
> 119064
> 60116
> 16082
> 16082
> 16303
> 16082
> 92628
> 92628
> 60083
>(10 rows)
>
>
>I think there must be something you didn't tell us...
>
> regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://archives.postgresql.org

_____________________________________________________________
Get yourname(at)dugem(dot)com at http://www.dugem.com

_____________________________________________________________
Promote your group and strengthen ties to your members with email(at)yourgroup(dot)org by Everyone.net http://www.everyone.net/?btn=tag

Browse pgsql-sql by date

  From Date Subject
Next Message Yon Den Baguse Ngarso 2002-08-23 08:28:35 Re: SELECT ... WHERE ... NOT IN (SELECT ...);
Previous Message Björn Lundin 2002-08-23 06:53:46 Re: speeding up \d commands.