Re: Cross-Tab queries in postgres?

From: Joe Conway <mail(at)joeconway(dot)com>
To: wsheldah(at)lexmark(dot)com
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cross-Tab queries in postgres?
Date: 2002-07-23 04:21:29
Message-ID: 3D3CD9C9.7080609@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

wsheldah(at)lexmark(dot)com wrote:
> In MS Access, crosstab queries are implemented with the keyword TRANSFORM, IIRC.
> The easiest way to figure them out is to build a cross-tab query with the GUI
> query builder, then look at the SQL it produces. I think this might be
> implemented in SQL Server as well. It can be handy, but if there's not something
> comparable in the SQL standard, I'd rather see several other features added long
> before this one. Just my two cents.
>

It's not in MSSQL Server at least through version 7 (just checked). I
don't think it has been added in MSSQL 2000 either, but I can't really
check that at the moment.

MS Access syntax is like this:

TRANSFORM Max(Table1.value) AS MaxOfvalue
SELECT Table1.name
FROM Table1
GROUP BY Table1.name
PIVOT Table1.cat;

but it *only* seems to allow TRANSFORM on an aggregate.

Syntax
TRANSFORM aggfunction
selectstatement
PIVOT pivotfield [IN (value1[, value2[, ...]])]

Joe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Roberto Mello 2002-07-23 05:45:07 Re: Editor for pgsql
Previous Message Joe Conway 2002-07-23 03:59:24 Re: Access Two Databases