Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 498E7476865 for ; Fri, 17 Jan 2003 09:59:41 -0500 (EST) Received: from wolff.to (wolff.to [66.93.249.74]) by postgresql.org (Postfix) with SMTP id 93075476840 for ; Fri, 17 Jan 2003 09:59:40 -0500 (EST) Received: (qmail 1808 invoked by uid 500); 17 Jan 2003 15:12:03 -0000 Date: Fri, 17 Jan 2003 09:12:03 -0600 From: Bruno Wolff III To: Andrew Perrin Cc: Tim Lynch , pgsql-admin@postgresql.org Subject: Re: OT: seeking query help, where? Message-ID: <20030117151203.GA1798@wolff.to> Mail-Followup-To: Andrew Perrin , Tim Lynch , pgsql-admin@postgresql.org References: <071501c2bdac$cabaa790$2c0210ac@loisaida> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.25i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/190 X-Sequence-Number: 7032 On Fri, Jan 17, 2003 at 08:57:14 -0500, Andrew Perrin wrote: > I'd suggest something similar to, but slightly different from, what others > have: > > SELECT DISTINCT email FROM (SELECT email FROM table_1 UNION SELECT > email FROM table_2) AS combined; > > that way you avoid duplicates across tables. The union operator already removes duplicates.