X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EE6C0D1B449 for ; Tue, 13 Jan 2004 00:01:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 00480-02 for ; Mon, 12 Jan 2004 20:00:32 -0400 (AST) Received: from kogut2.o2.pl (kogut2.o2.pl [212.126.20.58]) by svr1.postgresql.org (Postfix) with ESMTP id 86919D1B461 for ; Mon, 12 Jan 2004 20:00:25 -0400 (AST) Received: from bronx (chello212186137039.chello.pl [212.186.137.39]) by kogut2.o2.pl (Postfix) with SMTP id 8AB6EAA063 for ; Tue, 13 Jan 2004 01:00:26 +0100 (CET) Message-ID: <00ca01c3d968$07c05fe0$0201a8c0@bronx> From: "Bronx" To: Subject: Is it possible in PostgreSQL? Date: Tue, 13 Jan 2004 00:58:52 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00C7_01C3D970.692DCE40" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=4.7 tagged_above=0.0 required=5.0 tests=HTML_50_60, HTML_FONT_FACE_ODD, RCVD_IN_DSBL X-Spam-Level: **** X-Archive-Number: 200401/142 X-Sequence-Number: 12005 This is a multi-part message in MIME format. ------=_NextPart_000_00C7_01C3D970.692DCE40 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Hi, I've got problem with one specific query. I've got the table with many of rekords like these: name | quantity | date ------------------------------------------------------- aaa 2 2003-04-01 bbb 4 2003-04-12 ccc 5 2003-05-12 aaa 3 2003-01-14 aaa 1 2003-12-09 bbb 9 2003-08-08 and so on ... Does anybody know how make query which return grouped=20 records by month of year and name (also sum of quantity).=20 It is possible to make a query whitch return something like that: name | 01 | 02 | 03 | 04 | ... | 12 (months) ------------------------------------------------ aaa x x x x ... x bbb x x x x ... x ccc x x x x ... x where x means sum of quantity in month. It is possible to make it in one query? I know that in Access is construction : PIVOT. Thanks=20 Adam ------=_NextPart_000_00C7_01C3D970.692DCE40 Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable
Hi,
I've got problem with one specific qu= ery. I've=20 got the table
with many of rekords like these:
 
name    =20 |  quantity    | date
-------------------------------------------------------
aaa      &nb= sp;=20     2           = ;=20     2003-04-01
bbb      &nb= sp;=20     4           = ;=20     2003-04-12
ccc      &nb= sp;=20     5           = ;=20     2003-05-12
aaa      &nb= sp;=20     3           = ;=20     2003-01-14
aaa          &nb= sp;=20 1            &n= bsp;  =20 2003-12-09
bbb          &nb= sp;=20 9               = ;=20 2003-08-08
 
and so on ...
 
Does=20 anybody know how make query which return grouped
records by month of year an= d name=20 (also sum of quantity).
It is possible to make a query whitch= return=20 something like that:
 
name | 01 | 02 | 03 | 04 | ... | 12= =20 (months)
------------------------------------------------
aaa    =20 x     x     x   = ;=20 x    ...   x
bbb    =20 x     x     x   = ;=20 x    ...   x
ccc    =20 x     x     x   = ;=20 x    ...   x
 
where x means sum of quantity in month.
It is possible to make it in one query?
I know that in Access is construction : PIVOT.
 
Thanks
Adam
 
------=_NextPart_000_00C7_01C3D970.692DCE40--