Re: Cross-Tab queries in postgres?

From: wsheldah(at)lexmark(dot)com
To: Joe Conway <mail(at)joeconway(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-22 13:54:00
Message-ID: 200207221353.JAA28008@interlock2.lexmark.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Wes Sheldahl

Joe Conway <mail%joeconway(dot)com(at)interlock(dot)lexmark(dot)com> on 07/22/2002 03:09:42 AM

To: Martijn van Oosterhout <kleptog%svana(dot)org(at)interlock(dot)lexmark(dot)com>
cc: Postgresql General <pgsql-general%postgresql(dot)org(at)interlock(dot)lexmark(dot)com>
(bcc: Wesley Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] Cross-Tab queries in postgres?

Martijn van Oosterhout wrote:
> I know they're not supported and that they should be done in the
> presentation end of the software. However, I have a case where I need to use
> the result as the input to another query. So I'm reading the output, doing
> the cross-tab and copying the result back into the database.
>

[snip]

> Anyway, it doesn't seem to hard to implement so I was wondering if any other
> database systems actually implement it. Mostly I'm interested in what syntax
> they use to indicate such a query. (I presume it's not in the standard or
> it'd be there already).

I haven't seen this except in MS Access. I don't think you can directly
produce a crosstab in MS SQL Server or Oracle, although in Oracle you
can build your own table function.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Elielson Fontanezi 2002-07-22 13:59:30 pgsql editor
Previous Message Janning Vygen 2002-07-22 13:39:43 to_char(0,'FM990D99') = "0." instead of "0"