Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> need query of wildly unormalized table
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)
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
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? Received on Thu Oct 11 2007 - 10:46:11 CDT
![]() |
![]() |