1 2 3 4 5 6 7
| select id_vehicule,jour from vehicule_affectation
join (Select level + to_date('01/04/2013', 'dd/mm/yyyy') - 1 as jour from dual
connect by level < to_date('10/04/2013', 'dd/mm/yyyy') - to_date('01/04/2013', 'dd/mm/yyyy') + 2) TJOUR on TJOUR.jour>=date_debut and TJOUR.jour<=date_fin
where
to_char(date_debut,'YYYYMMDD')>='20130402' and to_char(date_debut,'YYYYMMDD')<='20130401' and id_client='10123'
OR to_char(date_fin,'YYYYMMDD')>='20130402' and to_char(date_fin,'YYYYMMDD')<='20130401' and id_client='10123'
OR to_char(date_debut,'YYYYMMDD')<='20130402' and to_char(date_fin,'YYYYMMDD')>='20130401'and id_client='10123' |
Partager