pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Hartwig <daveh@insightdist.com>
To: William Leeke <wleeke@ix.netcom.com>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] SQL equiv to MS-Access Transform
Date: Fri, 18 Sep 1998 08:47:28 -0400
Message-ID: <36025660.C8A6D0A6@insightdist.com> (raw)
References: <36020019.F0178A9D@ix.netcom.com>



William Leeke wrote:

> ver: postgresql-6.2.1-7
>
> OK, Ive been looking for solution for about 8 hours straight now and my
> head hurts.
>
> Is it possible to do this ...
> TRANSFORM Statement Examples
>
> SQL statement   Description
> PARAMETERS [Sales for which year?] LONG;
> TRANSFORM Sum([Order Details].Quantity * ([Order Details].
> [Unit Price] - ([Order Details].Discount / 100) * [Order Details].
> [Unit Price])) AS Sales
> SELECT [Product Name]
> FROM Orders INNER JOIN
> (Products INNER JOIN [Order Details]
> ON Products.[Product ID] = [Order Details].[Product ID]) ON
> Orders.[Order ID] = [Order Details].[Order ID]
> WHERE DatePart("yyyy", [Order Date]) = [Sales for which year?]
> GROUP BY [Product Name]
> ORDER BY [Product Name]
> PIVOT DatePart("m", [Order Date]);
>
> Creates a crosstab query that shows product sales by month for a
> user-specified year.  The months are displayed from left to right
> (pivoted) as columns, and the product names are displayed from top to
> bottom as rows.
>
> ...with in postgres?
>
> If this is a sore subject, I appologize ahead of time.
> If this is referenced in a FAQ somewhere, please point the way.
>
> Pivoting time data from rows to columns *seems to be a common if
> non-intuitive thing to do with a database. :)
>

TRANSFORM/PIVOT are not available at this time in the server.   And, I am
not aware any plans to implement them in the near future.  (A plea could be
made)
This kind of query can be performed quite easily using ODBC tools via the
MS Jet Engine.   (MS Access, Excel, DOA controls etc.)  I will continue
with this discussion if  this interest you.




view thread (2+ messages)

Message-ID: <36025660.C8A6D0A6@insightdist.com>
Permalink:  ../36025660.C8A6D0A6@insightdist.com/
Also on:    postgresql.org/message-id/36025660.C8A6D0A6@insightdist.com

 · 

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-sql@postgresql.org
  Cc: daveh@insightdist.com, wleeke@ix.netcom.com
  Subject: Re: [SQL] SQL equiv to MS-Access Transform
  In-Reply-To: <36025660.C8A6D0A6@insightdist.com>
  References: <36020019.F0178A9D@ix.netcom.com> <36025660.C8A6D0A6@insightdist.com>

* 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