Re: A How-To

  • From: Jeff Eberhard <jeff.eberhard@xxxxxxxxx>
  • To: BurtonL@xxxxxxxxxxx
  • Date: Mon, 23 May 2005 10:15:26 -0600

Something like this:
select record_key,
max(decode(id,31,value,'')) start_time,
max(decode(id,19,value,'')) shift,
max(decode(id,10,value,'')) rate
from t1
group by record_key;

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') c
where a.record_key = b.record_key
and b.record_key = c.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@xxxxxxxxxxx> 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.

> --
> //www.freelists.org/webpage/oracle-l
>

--
//www.freelists.org/webpage/oracle-l
  • References:

Other related posts: