X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2D482D1B178 for ; Fri, 14 May 2004 02:24:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 17495-01 for ; Fri, 14 May 2004 02:24:07 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id B8DF3D1B1D3 for ; Fri, 14 May 2004 02:24:06 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 7FA7C35251; Thu, 13 May 2004 22:24:06 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 7DD3335246; Thu, 13 May 2004 22:24:06 -0700 (PDT) Date: Thu, 13 May 2004 22:24:06 -0700 (PDT) From: Stephan Szabo To: sad Cc: pgsql-sql@postgresql.org Subject: Re: a wierd query In-Reply-To: <200405140745.48296.sad@bankir.ru> Message-ID: <20040513222259.D23568@megazone.bigpanda.com> References: <323910-220045413878445@M2W099.mail2web.com> <200405131134.35156.sad@bankir.ru> <40A393FF.3030806@onesystem.com> <200405140745.48296.sad@bankir.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/129 X-Sequence-Number: 17843 On Fri, 14 May 2004, sad wrote: > On Thursday 13 May 2004 19:27, you wrote: > > sad wrote: > > > select distinct a as F from table > > > union > > > select distinct b as F from table; > > > > Note that UNION only returns the unique values of the union > > You can get repeated values by using UNION ALL. > > read the original problem > look at the DISTINCT clause in my query > and think again What about the fact that union already removes duplicates?