日期:2014-05-17 浏览次数:21167 次
--LZ,看下这个结果是不是你要的
SQL> with model(model_id,condition_id) as(
2 select '0000000001',1 from dual
3 union all select '0000000001',3 from dual
4 union all select '0000000002',2 from dual
5 union all select '0000000002',3 from dual
6 union all select '0000000003',4 from dual
7 ),
8 rule(rule_id,condition_id) as(
9 select '01',1 from dual
10 union all select '01',4 from dual
11 union all select '02',3 from dual
12 union all select '03',2 from dual
13 union all select '03',3 from dual
14 )
15 select model_id,rule_id from
16 (select model_id,wm_concat(condition_id) c from model
17 group by model_id) t1,
18 (select rule_id,wm_concat(condition_id) c from rule
19 group by rule_id) t2
20 where t1.c=t2.c;
MODEL_ID RULE
--------