X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C8750474E4F for ; Fri, 2 May 2003 04:48:40 -0400 (EDT) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by postgresql.org (Postfix) with ESMTP id 9DA93474E4F for ; Fri, 2 May 2003 04:48:09 -0400 (EDT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) id 19BWDC-000PDU-0U; Fri, 02 May 2003 09:48:10 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 36135166F8; Fri, 2 May 2003 09:48:08 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 94AF3162C9; Fri, 2 May 2003 09:48:05 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: "Daniel Dunajsky" , Subject: Re: How to write an query to get this result? Date: Fri, 2 May 2003 09:48:35 +0100 User-Agent: KMail/1.4.3 References: <01be01c30f8e$d9cbf160$0300a8c0@akssk> In-Reply-To: <01be01c30f8e$d9cbf160$0300a8c0@akssk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305020948.36607.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Spam-Status: No, hits=-38.1 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_KMAIL 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/16 X-Sequence-Number: 13181 On Thursday 01 May 2003 4:07 am, Daniel Dunajsky wrote: > Hello, > > Is there any way how to retrieve result normally displayed as: > > TOTAL 268 > Administrator 7 > Internet Only 178 > Filtered Internet 7 > > To be like this: > > TOTAL Administrator Internet Only Filtered Internet > 268 7 178 7 > > That means, the rows of the first column of the first case are headers in > the second case. Similarly, the rows of the second column are displayed as > one row. There are some crosstab-style functions in the contrib directory in source.= =20 Can't remember where, sorry. Look for something like "cross-tab" or try the= =20 table-function examples. --=20 Richard Huxton