1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
select c.clequi, decode(c.clequi, t1.sigtie, '1', t2.sigtie, '2', t3.sigtie, '3', t4.sigtie, '4', t5.sigtie, '5', t6.sigtie, '6', t7.sigtie, '7', t8.sigtie, '8'/*, t9.sigtie, '9', t10.sigtie, '10', t10.siggrp, '11'*/, 'X') niveau, c.cleqoi, c.prxnet, c.datapp, c.datval
from cts c
inner join tie t1 on t1.codsoc = c.codsoc
left outer join tie t2 on t2.codsoc = t1.codsoc and t2.typtie = t1.typgrp and t2.sigtie = t1.siggrp
left outer join tie t3 on t3.codsoc = t2.codsoc and t3.typtie = t2.typgrp and t3.sigtie = t2.siggrp
left outer join tie t4 on t4.codsoc = t3.codsoc and t4.typtie = t3.typgrp and t4.sigtie = t3.siggrp
left outer join tie t5 on t5.codsoc = t4.codsoc and t5.typtie = t4.typgrp and t5.sigtie = t4.siggrp
left outer join tie t6 on t6.codsoc = t5.codsoc and t6.typtie = t5.typgrp and t6.sigtie = t5.siggrp
left outer join tie t7 on t7.codsoc = t6.codsoc and t7.typtie = t6.typgrp and t7.sigtie = t6.siggrp
left outer join tie t8 on t8.codsoc = t7.codsoc and t8.typtie = t7.typgrp and t8.sigtie = t7.siggrp
--left outer join tie t9 on t9.codsoc = t8.codsoc and t9.typtie = t8.typgrp and t9.sigtie = t8.siggrp
--left outer join tie t10 on t10.codsoc = t9.codsoc and t10.typtie = t9.typgrp and t10.sigtie = t9.siggrp
where c.codsoc = 100
and c.achvte = 'V'
and c.typcot = 'LIG'
and decode(c.datval, ' ', '99999999') >= '20110606'
and c.datapp <= '20110606'
and t1.typtie = 'CLI' and t1.sigtie = '243392'
and c.cleqoi like '2750300%'; |
Partager