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: Roy Brokvam <roy.brokvam_at_conax.com>
Date: Fri, 19 Feb 1999 07:40:45 +0100
Message-ID: <7aj171$anh$1@readme.online.no>


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 Received on Fri Feb 19 1999 - 00:40:45 CST

Original text of this message

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