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

Home -> Community -> Usenet -> c.d.o.server -> Re: how do I combine 24 rows(3 columns) into one row (

Re: how do I combine 24 rows(3 columns) into one row (

From: TurkBear <johng_at_nospam.mm.com>
Date: Fri, 19 Feb 1999 15:12:44 GMT
Message-ID: <36cd7eb8.1923165@news2.mm.com>


The advice at the end of Roy's note is the best way, in my opinion, to go. SqlPlus ( or Sql) is not the way to attempt this type of retreival....Try a report generator like Crystal Reports or export to Excel and make a cross-tab report --- it will be far simpler and easier to manipulate and read....

Remember the old adage, " If the only tool you have is a hammer, everything looks like a nail"

Hope it helps,

"Roy Brokvam" <roy.brokvam_at_conax.com> wrote:

>Hi!
>
>I'm not sure you really want do do this in SQL. The number of columns is a
>static property of a SQL query.
>
>So, do you know that there always are 24 rows in your table? If so, you'll
>end up with a clumsy query á la
>
>select
> tab1.hour hour1,
> tab2.hour hour2,
> tab3.hour hour3,
> ...
> tab24.hour hour24
>from
> hourtable tab1,
> hourtable tab2,
> hourtable tab3,
> ...
> hourtable tab24
>where
> tab1.rowid < tab2.rowid and
> tab2.rowid < tab3.rowid and
> tab3.rowid < tab4.rowid and
> ...
> tab23.rowid < tab24.rowid;
>
>If the number of rows in your table is dynamic; can't do. Try exporting to a
>spreadsheet and do a transpose there instead.
>
>HTH,
>
>Roy Brokvam
>roy.brokvam_at_conax.com
>
>
>

To reply please remove the 'nospam' part of the address Received on Fri Feb 19 1999 - 09:12:44 CST

Original text of this message

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