1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| with Tb1 as
(
select 'User1' utilisateur ,'profil1' profile ,'job1' job from dual union
select 'User1','profil2','job2' from dual union
select 'User2','profil1','job3' from dual union
select 'User2','profil3','job4' from dual
),
Tb2 as
(
select 'User1' utilisateur ,'profil1' profile ,to_date('10/10/2010','dd/mm/yyyy') date_debut,to_date('10/10/2011','dd/mm/yyyy')date_fin from dual union
select 'User1','profil2',to_date('15/09/2010','dd/mm/yyyy'),to_date('15/09/2015','dd/mm/yyyy') from dual
)
select *
from Tb1 join Tb2 on Tb1.utilisateur =Tb2.utilisateur and Tb1.profile=Tb2.profile
where sysdate between Tb2.date_debut and Tb2.date_fin |
Partager