Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 8AFBC1337B69 for ; Wed, 9 Mar 2011 13:23:44 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 20813-05 for ; Wed, 9 Mar 2011 17:23:36 +0000 (UTC) X-Greylist: delayed 00:06:48.500121 by SQLgrey-1.7.6 Received: from mail.affinitas.de (mail.affinitas.de [91.102.12.84]) by mail.postgresql.org (Postfix) with ESMTP id 35D171337B97 for ; Wed, 9 Mar 2011 13:23:36 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.affinitas.de (Postfix) with ESMTP id 92476246A01A for ; Wed, 9 Mar 2011 18:16:45 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.affinitas.de Received: from mail.affinitas.de ([127.0.0.1]) by localhost (mail.affinitas.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hTa5OANERLJJ for ; Wed, 9 Mar 2011 18:16:44 +0100 (CET) Received: from [192.168.6.181] (unknown [91.102.12.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.affinitas.de (Postfix) with ESMTPSA for ; Wed, 9 Mar 2011 18:16:44 +0100 (CET) Message-ID: <4D77B5FC.6010502@affinitas.de> Date: Wed, 09 Mar 2011 18:16:44 +0100 From: Eric Ndengang User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: How to transform table rows into Colum? Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/14 X-Sequence-Number: 35216 Hi Guys, I have the following table: Name Value rang salary ------------------------------------ name1 value1 1 2500 name2 value2 2 2600 name3 value 3 3 300 and want to obtain the following result: name1 name2 name3 ------------------------------------ value1 value2 value3 1 2 3 2500 2600 300 what should i do ? I read about the crosstab function in postgresql but still have no idea on how to use it to solve this problem. Any help would be appreciated Regards -- Eric Ndengang Datenbankadministrator Affinitas GmbH | Kohlfurter Straße 41/43 | 10999 Berlin | Germany email: eric.ndengang_foyet@affinitas.de | tel: +49.(0)30. 991 949 5 0 | www.edarling.de Geschäftsführer: Lukas Brosseder, David Khalil, Kai Rieke, Christian Vollmann Eingetragen beim Amtsgericht Berlin, HRB 115958