X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id BE545B4388E for ; Tue, 8 Jul 2003 08:45:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 64486-08 for ; Tue, 8 Jul 2003 05:44:52 -0300 (ADT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id A64F2B438AE for ; Tue, 8 Jul 2003 05:44:50 -0300 (ADT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Tue Jul 08 10:46:00 2003 +0200 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id KAA12916; Tue, 8 Jul 2003 10:44:50 +0200 (METDST) Message-ID: <3F0A8481.D9F01154@rodos.fzk.de> Date: Tue, 08 Jul 2003 10:44:50 +0200 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org, avsoledadjr@hotmail.com Subject: Re: columnar format Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/83 X-Sequence-Number: 14197 > > i would like to ask for the sql statement to the output: > > ITEM DESC Jan Feb Mar Apr ... Sep Total > xxxxxxxxxx 999 999 999 999 ... 999 9,999 > > where "Jan" column is sum of all "x" items purchased on Jan, "Feb" column as > sum of Feb purchases, and so on up to "Sep", and "Total" as the total from > "Jan" to "Sep" (as in the case here). the numbers may/may not be formatted, > and the period varies, depending on the range. > Search the archives for pivot tables resp. crosstab and/or have a look at $PGSQLD/contrib/tablefunc/README.tablefunc Regards, Christoph