Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [206.210.65.6]) by hub.org (8.9.2/8.9.1) with ESMTP id LAA25617 for ; Tue, 13 Apr 1999 11:39:09 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id LAA27288; Tue, 13 Apr 1999 11:37:43 -0400 (EDT) To: Walt Bigelow cc: pgsql-sql@hub.org Subject: Re: [SQL] subqueries In-reply-to: Your message of Mon, 12 Apr 1999 23:00:37 -0400 (EDT) <199904130300.XAA21309@hub.org> Date: Tue, 13 Apr 1999 11:37:43 -0400 Message-ID: <27286.924017863@sss.pgh.pa.us> From: Tom Lane Walt Bigelow 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