Re: [SQL] subqueries

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Walt Bigelow <walt@stimpy.com>
Cc: pgsql-sql@hub.org
Date: 1999-04-13T15:37:43Z
Lists: 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