Re: Re: Crosstab SQL Question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: Crosstab SQL Question
Дата
Msg-id 5814.961136071@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Crosstab SQL Question  (Paul Condon <pecondon@quiknet.com>)
Список pgsql-general
Paul Condon <pecondon@quiknet.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: using max() aggregate
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: Crosstab SQL Question