Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 3A6BF9F9FC1 for ; Mon, 8 Oct 2007 07:54:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 82884-05 for ; Mon, 8 Oct 2007 07:54:28 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by postgresql.org (Postfix) with ESMTP id 105D09F9FBD for ; Mon, 8 Oct 2007 07:54:28 -0300 (ADT) Received: from webserv.wug.de ([194.25.154.138]) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis) id 0ML2xA-1IeqFk0ZHd-0001N2; Mon, 08 Oct 2007 12:54:25 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1IeqFi-0006ct-00 for pgsql-sql@postgresql.org; Mon, 08 Oct 2007 12:54:22 +0200 Date: Mon, 8 Oct 2007 12:54:22 +0200 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: Get different sums from the same table in one query Message-ID: <20071008105422.GC15336@a-kretschmer.de> References: <470A0B20.40203@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <470A0B20.40203@gmail.com> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX18OFao6pFOxtg5mhXjCfNAeLpkPnZlQkXkzOMo a63yMhC8ciqcnNpSJ+Gzlmg59uqjbE4zCxmj94+pb+yjHsrndC JgDGapWemjHVFBb7RTh9YGWKs8DQ1NC X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/38 X-Sequence-Number: 29410 am Mon, dem 08.10.2007, um 12:49:04 +0200 mailte Dani Castaņos folgendes: > Hi all! > > I want to put this three queries in only one... Take a look that the > only thing that changes is the message_type_id. Any suggestions?? Yes, no problem, You can use UNION (ALL) for such. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net