Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: A How-To
The decode example works like a charm!!! Thank you so much.
-----Original Message-----
From: Jeff Eberhard [mailto:jeff.eberhard_at_gmail.com]
Sent: Monday, May 23, 2005 11:15 AM
To: Burton, Laura
Cc: oracle-l_at_freelists.org
Subject: Re: A How-To
Something like this:
select record_key,
max(decode(id,31,value,'')) start_time, max(decode(id,19,value,'')) shift, max(decode(id,10,value,'')) ratefrom t1
or this:
select a.record_key, start_time, shift, rate
from (select record_key, value start_time from t1 where id = '31') a, (select record_key, value shift from t1 where id = '19') b, (select record_key, value rate from t1 where id = '10') cwhere a.record_key = b.record_key
Of course both of these have a lot of assumptions about the data, such as there always being a row (and only one row) for each value specified. And I won't get into the performance pains this may create.
--Jeff
On 5/23/05, Burton, Laura <BurtonL_at_frmaint.com> wrote:
> I have a table which has multiple records for one individual. Each
> record represents a different field, i.e. id 31 represents start time,
> id 19 represents shift, id 10 represents rate, etc.
> --
> http://www.freelists.org/webpage/oracle-l
>
-- http://www.freelists.org/webpage/oracle-lReceived on Mon May 23 2005 - 12:25:49 CDT
![]() |
![]() |