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