Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9447A9FBA0F for ; Wed, 28 Mar 2007 11:14:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 94120-02 for ; Wed, 28 Mar 2007 11:14:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from fmed.uba.ar (mail.fmed.uba.ar [157.92.152.1]) by postgresql.org (Postfix) with ESMTP id 4DB2C9FB9FE for ; Wed, 28 Mar 2007 11:14:43 -0300 (ADT) Received: from [157.92.155.58] (unknown [157.92.155.58]) by fmed.uba.ar (Postfix) with ESMTP id 71A704CFD9F for ; Wed, 28 Mar 2007 11:25:42 -0300 (ART) Message-ID: <460A75ED.6070501@fmed.uba.ar> Date: Wed, 28 Mar 2007 11:04:29 -0300 From: Gerardo Herzig User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: union with count? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/331 X-Sequence-Number: 27969 Hi dudes, i have the following question i have 2 tables with the same format, and i want to know if is there a possibility of using some sort of count(*) for achieving this result: select a from table1 where (condition) union select a from table2 where (condition), count(a) group by a The idea is having how many times (condition) is true for both tables. Im not shure im explaining myself clearly, my english is not the best (as you can see ;) Thanks! Gerardo