Re: Re: Crosstab SQL Question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul Condon <pecondon(at)quiknet(dot)com>
Cc: matt(at)ctlno(dot)com, pgsql-general <pgsql-general(at)hub(dot)org>
Subject: Re: Re: Crosstab SQL Question
Date: 2000-06-16 06:14:31
Message-ID: 5814.961136071@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Paul Condon <pecondon(at)quiknet(dot)com> writes:
> There are lots of issues with how one displays a crosstab which are not
> easily addressed within the context of RDBMS. I suggest the PostgreSQL
> team not plan to add crosstabs to PostgreSQL, ...

As near as I could see, the data that was being asked for was exactly
what you could get from a GROUP BY with multiple group columns:

SELECT salesman, month, SUM(netprice) FROM salesorders
GROUP BY salesman, month;

However the raw SQL output would look like

Jim Jan 1100
Jim Feb 1500
...
Joe Jan 120
Joe Feb 1200
...

so what's really wanted is a frontend to reformat this into a nicely
presented table. I agree with Paul that that's not the task SQL is
designed for, whereas there are lots of data-visualization tools that
*are* designed for it.

> I have found a nice implementation of crosstabs in R, which is a
> system/language for statistical analysis, data display, and data
> plotting. <www.r-project.org>

Yup, R is cool (and free). Anyone up for making an R-to-PGSQL
interface?

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-06-16 06:49:23 Re: Performance for indexes on functions
Previous Message Michael Meskes 2000-06-16 06:09:00 Re: Crosstab SQL Question