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
|
(
select nom,
prenom,
identifiant,
matricule,
nomsociete,
date_debut_contrat,
date_fin_contrat,
date_reglement
from table1
inner join table2...
inner join table3
inner join table 4
.....
where matricule='0123456'
and date_fin_contrat >= to_date('2016/12/31 23:59:59','yyyy/mm/dd hh24:mi:ss')
and date_reglement >= to_date('2016/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss')
and date_reglement <= to_date('2016/12/31 23:59:59','yyyy/mm/dd hh24:mi:ss')
and date_reglement <= date_fin_contrat
)
union
(
select nom,
prenom,
identifiant,
nomsociete,
date_debut_contrat,
date_fin_contrat,
date_reglement
from table1
inner join table2...
inner join table3
inner join table 4
.....
WHERE date_reglement >= to_date('2016/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss')
and date_reglement <= to_date('2016/12/31 23:59:59','yyyy/mm/dd hh24:mi:ss')
and date_reglement <= date_fin_contrat
AND date_fin_contrat <> to_date('2999/12/31','yyyy/mm/dd') -- SANS DATE DE FIN
and identifiant in (
select
identifiant
from table1
inner join table2...
inner join table3
inner join table 4
.....
where matricule='0123456'
and date_reglement >= to_date('2016/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss')
and date_reglement <= to_date('2016/12/31 23:59:59','yyyy/mm/dd hh24:mi:ss')
and date_reglement <= date_fin_contrat
)
) |
Partager