Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: need query of wildly unormalized table
On Oct 11, 10:46 am, EdStevens <quetico_..._at_yahoo.com> wrote:
> Platform: Oracle 10.2.0.1.0
>
> Given a table with a structure something like this
>
> key_field varchar2(10)
> award_1 varchar2(4)
> award_2 varchar2(4)
> award_3 varchar2(4)
> <snip repeatage>
> award_30 varchar2(4)
>
> The requirement is to report all 'key_field' where any of the
> 'award_*' columns contain a selected value. The crude way is
>
> SELECT key_field
> FROM .....
> WHERE
> award_1 = 'AAAA' or
> award_2 = 'AAAA' or
> award_3 = 'AAAA' or
> <snip repeatage>
> award_30 = 'AAAA' or
>
> Surely there is a more elegant way of dealing with this mess, but I'm
> having trouble getting my head wrapped around it. Unfortunately,
> normalizing the data (what a concept!) is beyond my control, other
> than the possibility of using a temp table.
>
> Ideas?
Thanks to all for several good ideas. I think one of the views will meet our needs. Believe me, if I had the power to change the table design I would ... here and several other places in the schema. Received on Mon Oct 15 2007 - 07:51:57 CDT