Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Crosstab with Oracle SQL, PL/SQL

Re: Crosstab with Oracle SQL, PL/SQL

From: <steveee_ca_at_my-deja.com>
Date: Sat, 09 Dec 2000 13:41:39 GMT
Message-ID: <90tcqj$f51$1@nnrp1.deja.com>

Hi,

If you're using 8i you can also check out CUBE with GROUP BY.. It allows a certain amount of crosstab type of summation..I haven't had occassion to use it myself yet, so this is one of those 'experimental' suggestions..
Maybe it'll be useful.

Regards,

Steve

In article <3a32294d.9917330_at_news.online.de>,   knijff_at_bigfoot.com (Ted Knijff) wrote:
> Check the DECODE expression. The documentation has an example to do
> what you want something like :
> select country,decode(year,1997,amount,0) as y1997,
> decode(year,1998,amount,0) as y1998...
>
> You can use this as a subselect and:
> select country,sum(y1997),.. from (subselect) group by country
> or something similar.
>
> HTH
>
> Ted
>
> On Thu, 07 Dec 2000 14:43:56 +0100, chris <dawnchri_at_gmx.de> wrote:
>
> >Hello,
> >
> >does anybody can give me an easy example in Oracle SQL, PL/SQL of a
> >'crosstable' like following,
> >
> >from...
> >
> >USA 1997 44
> >China 1997 64
> >Canada 1997 13
> >USA 1998 47
> >China 1998 78
> >Canada 1998 97
> >
> >
> >to...
> >
> > 1997 1998
> >USA 44 47
> >China 64 78
> >Canada 13 97
> >
>
> EMail: knijff_at_bigfoot.com
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sat Dec 09 2000 - 07:41:39 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US