Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: remapping and keeping original value?
When I have trouble, I try to break the problem into smaller pieces.
Here's my thinking:
select id, var2, decode(var2,.........................) flag from a_table;
Then if this appears to be producing the basic data you want,
select id, var2, min(flag) flag
from
( select id, var2, decode(var2,.........................) flag froma_table )
Then if this appears to be producing the results you want, try and get rid of the nested query.
Douglas Nichols <dnichols_at_fhcrc.org> wrote in message
news:38349285.20847BAA_at_fhcrc.org...
> I am trying to remap a field so I can order the out come then get the
> original field.
> Something like this:
> I have mydata ( id, var1, var2);
> I need to eval var2 as decode(var2, 1,1,0,2,2,3,4,0,5) as flag;
> Find the lowest value of flag then return id, var2
>
> something like
> select id, var2, min(decode(var2,1,1,0,2,2,3,3,0,5)) as flag
> from mydata
> group by id;
>
> This doesn't but this is like what I am after.
>
> Thanks ahead of time!
>
> --
> Cheers, dn
>
> Douglas Nichols dnichols_at_fhcrc.org
> ---------------------------------------------------------------
> National Wilms Tumor Study Group 206.667.4283
> Seattle, WA
Received on Thu Nov 18 1999 - 18:26:06 CST
![]() |
![]() |