X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4775B476036 for ; Thu, 1 May 2003 02:39:52 -0400 (EDT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 733F5475F6A for ; Thu, 1 May 2003 02:39:51 -0400 (EDT) Received: from klaster.net (pc200.krakow.cvx.ppp.tpnet.pl [213.76.38.200]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 1820D2B3D8; Thu, 1 May 2003 08:39:48 +0200 (CEST) Message-ID: <3EB0C140.7040700@klaster.net> Date: Thu, 01 May 2003 08:40:00 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; PL; rv:1.3) Gecko/20030312 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: daniel_katka@hotmail.com Cc: pgsql-sql@postgresql.org Subject: Re: How to write a sql query to get this result? References: <020601c30f92$22174ca0$0300a8c0@akssk> In-Reply-To: <020601c30f92$22174ca0$0300a8c0@akssk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-31.5 required=5.0 tests=BAYES_10,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_MOZILLA_UA autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/2 X-Sequence-Number: 13167 Dnia 2003-05-01 05:31, Uz.ytkownik Daniel napisa?: > Hello, >=20 > Is there any way how to retrieve result normally displayed as: >=20 > TOTAL 268 > Administrator 7 > Internet Only 178 > Filtered Internet 7 >=20 > To be like this: >=20 > TOTAL Administrator Internet Only Filtered Internet > 268 7 178 7 >=20 > That means, the rows of the first column of the first case are headers in= =20 > the second case. Similarly, the rows of the second column are displayed a= s=20 > one row. >=20 > Please reply to daniel_katka@hotmail.com Find samething about contrib/tablefunc This problem is well known as cross tab (pivot table). Regards, Tomasz Myrta