1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
(
select t1.nom,
t1.prenom,
t1.identifiant,
t1.matricule,
t1.nomsociete,
t1.date_debut_contrat,
t2.date_fin_contrat,
t3.date_reglement
from table1 t2
inner join table2 t2
inner join table3 t3
inner join table4 t4
.....
where t1.matricule='0123456'
and t2.date_fin_contrat >= to_date('2016/12/31 23:59:59','yyyy/mm/dd hh24:mi:ss')
and t3.date_reglement >= to_date('2016/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss')
and t3.date_reglement <= to_date('2016/12/31 23:59:59','yyyy/mm/dd hh24:mi:ss')
and t3.date_reglement <= t2.date_fin_contrat
)
union
(
select t1.nom,
t1.prenom,
t1.identifiant,
t1.matricule,
t1.nomsociete,
t1.date_debut_contrat,
t2.date_fin_contrat,
t3.date_reglement
from table1 t1
inner join table2 t2
inner join table3 t3
inner join table4 t4
.....
WHERE t3.date_reglement >= to_date('2016/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss')
and t3.date_reglement <= to_date('2016/12/31 23:59:59','yyyy/mm/dd hh24:mi:ss')
and t3.date_reglement <= date_fin_contrat
AND t2.date_fin_contrat <> to_date('2999/12/31','yyyy/mm/dd') -- SANS DATE DE FIN
and t1.identifiant in (
select
t01.identifiant
from table1 t01
inner join table2 t02
inner join table3 t03
inner join table4 t04
.....
where t01.matricule='0123456'
and t03.date_reglement >= to_date('2016/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss')
and t03.date_reglement <= to_date('2016/12/31 23:59:59','yyyy/mm/dd hh24:mi:ss')
and t03.date_reglement <= t02.date_fin_contrat
)
) |
Partager