Re: [SQL] subqueries - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] subqueries
Date
Msg-id 27286.924017863@sss.pgh.pa.us
Whole thread Raw
Responses Re: [SQL] subqueries
List pgsql-sql
Walt Bigelow <walt@stimpy.com> writes:
> SELECT agencyid, first, last 
> FROM tbladdress
> WHERE type = 1
> AND agencyid NOT IN
>     (SELECT distinct agencylink
>     FROM tbladdress 
>     WHERE type = 2)
> ORDER BY last;

Looks reasonable ...

> This query returns 0 rows [ when it shouldn't ].

Sounds like a bug.  What version of Postgres are you running?
What do you get from "EXPLAIN"ing that query?  What are the
data types of the columns being used?
        regards, tom lane


pgsql-sql by date:

Previous
From: "Glenn Waldron"
Date:
Subject: Trouble with null text fields
Next
From: Michael Davis
Date:
Subject: RE: [SQL] Trouble with null text fields