pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sim Zacks <sim@compulab.co.il>
To: PostgreSQL general <pgsql-general@postgresql.org>
Subject: crosstab function
Date: Tue, 14 Dec 2010 09:17:44 +0200
Message-ID: <4D071A18.2060205@compulab.co.il> (raw)

postgres 8.2.17

I am trying out the crosstab function (tablefunc contrib) for reporting 
needs and I'm having a problem.
I have customers and products and the data is the quantity purchased. I 
am grouping by customername, productname in the source sql. My category 
sql depends if I want the products or customers to be the columns.

When I make customers the rows and products the columns, it works fine. 
But when I make customers the columns and products the rows, there are 
duplicate product rows.

Is there a way to group the product rows so that the data results come 
back correct?



view thread (23+ messages)  latest in thread

Message-ID: <4D071A18.2060205@compulab.co.il>
Permalink:  ../4D071A18.2060205@compulab.co.il/
Also on:    postgresql.org/message-id/4D071A18.2060205@compulab.co.il

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: sim@compulab.co.il
  Subject: Re: crosstab function
  In-Reply-To: <4D071A18.2060205@compulab.co.il>
  References: <4D071A18.2060205@compulab.co.il>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox