var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Oracle: single-row search
Table structured as such:
item_id, serial_num,project_id, type, op_1, op_2, op_3, ..., op_20
and values are:
1234, -, 001, op_code, operation1, operation2, operation2a, null ..., null
1234, A, 001, status, X, X, Queue, null ..., null
1234, B, 001, status, X, X, Queue, null ..., null
1234, C, 001, status, X, X, Run, null ..., null
5555, -, 002, op_code, operation1a, opeartion2a, operation2b, null, ..., null
5555, A, 002, status, X, Queue, null, null, ..., null
5555, B, 002, status, X, Queue, null, null, ..., null
What I need to do is grab all the items which will hit a certain operation, is there an easier way than
I can't find a single-row function that accomodates this nor do any of my searches give me any results that help...
SELECT * FROM TABLE t1, WHERE t1.op_1 = 'operation1' OR t1.op_2 = 'operation1' OR ... t1.op_20 = 'operation1' AND type != 'status'
Thanks in advance!
The best I can think of would be easier to type:
Logically it is the same, just less typing.
FROM TABLE t1
WHERE 'status' != type
AND 'operation1' IN (t1.op_1, t1.op_2, t1.op3 ... t1.op_20);
Wouldn't it be great if I could type:
'operation1' IN (op_no%)
Thanks for the help...
It would have been better to have designed the table with one op column and have 20 rows, instead of one row with 20 op columns.
Normalization! Ain't it a wunnerful thing ?!?!
Originally Posted by
I see so many problems like this that would be a lot simpler if the database was in at least the third normal form. Unfortunately, while I can envision the perfect world, I can't even get a visitors pass!