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: jennfier <jenny_at_aol.com>
Date: 19 Feb 1999 13:56:45 -0600
Message-ID: <i6iz2.55602$O54.71434@newscene.newscene.com>

This has to be automatically done every day can not be any human interaction. That is why i asked for sql to do it, i can't be using excel or stuff like that see my solution of how sql can do it. i will embedded into a program that will run everyday

In article <36cd7eb8.1923165_at_news2.mm.com>, johng_at_nospam.mm.com wrote:
>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 - 13:56:45 CST

Original text of this message

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