X-Original-To: pgsql-general@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0C566475458 for ; Wed, 19 Feb 2003 08:40:52 -0500 (EST) Received: from relay12.austria.eu.net (relay12.Austria.eu.net [193.154.160.116]) by postgresql.org (Postfix) with ESMTP id 6637D475425 for ; Wed, 19 Feb 2003 08:40:51 -0500 (EST) Received: from relay2.austria.eu.net (endjinn.austria.eu.net [193.81.13.2]) by relay12.austria.eu.net (Postfix) with ESMTP id 2FAA9C4056; Wed, 19 Feb 2003 14:40:53 +0100 (CET) Received: from ICOMWE (office.icomedias.com [62.99.232.80] (may be forged)) by relay2.austria.eu.net (8.12.6/8.12.6) with SMTP id h1JDeo3V001983; Wed, 19 Feb 2003 14:40:51 +0100 (MET) Message-ID: <003b01c2d81c$3e716d20$8f01c00a@icomedias.com> From: "Mario Weilguni" To: , References: <200302200035.37249.jerome@gmanmi.tv> Subject: Re: SQL query... Date: Wed, 19 Feb 2003 14:38:53 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Spam-Status: NO ; 8 X-Spam-Level: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/1124 X-Sequence-Number: 37878 >if i have 5 tables and all of it has column X and i wanted to get unique >values in column X for all tables.. >can i do it in one query? sure. this is one way to do this: select distinct foo.X from ( select X from table1 union select X from table2 .... ) as foo; if the values are unique within every table, then you might want to omit the surrounding select.