A: null, 1, 2
B: null, a, B
Code: 10, 30
MSG: right, wrong, empty
Will be above the permutation and combination, but need to set up rules,
For example:
Empty (null, a, 20, when a null, the corresponding code needs to be 20, corresponding to the MSG is empty)
Empty, null, null, 20 (when A and B is null, according to A value judgment)
1, null, 30, wrong (when took the null B, corresponding code needs to be 30, corresponding to the MSG is wrong)
To (a, 1, 10, when a and B have value, the corresponding code needs to be 10, corresponding MSG is right)
These are only a few examples, permutation and combination need to all the above elements according to the rules, the arrangement of the output, best can be output to excel again, there is no limit to the method, have bosses can provide a train of thought, or a case in point let me reference, thank you very much,
CodePudding user response:
select t1. Col. A,
T2. The col b,
The case when the t1. Col is null then 20
The when t2. Col is null then 30
The when t1. Col is not null and t2. Col is not null then 10
The else 20 end code,
Case when t1. Col is null then the 'empty'
The when t2. Col is null then the 'wrong'
The when t1. Col is not null and t2. Col is not null then 'to'
The else 'empty' end MSG
The from (
Select the null col from dual
Union all select '1' col from dual
Union all select '2' col from dual) t1,
(
Select the null col from dual
Union all select the 'a' col from dual
Union all select 'b' col from dual) t2
;
CodePudding user response: