Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Two dates ranges

Eric SacramentoNov 9 2011 — edited Nov 9 2011
Hi Guys,

I have a problem here:

For example

SELECT
emp.id_employe,
taux.id_taux,
emp.nom_emp,
emp.prenom_emp,
taux.taux_tc,
per.periode_debut_tc,
per.periode_fin_tc,
fac.id_facture,
fac.periode_debut_fac,
fac.periode_fin_fac

FROM dtp_spe_factures fac

join dtp_spe_commandes com on COM.ID_COMMANDE = FAC.ID_COMMANDE
join dtp_spe_ao_consortiums con on CON.ID_AO_CONSORTIUM = COM.ID_AO_CONSORTIUM
join dtp_spe_taux_categories taux on TAUX.ID_AO_CONSORTIUM = CON.ID_AO_CONSORTIUM
join dtp_spe_categories cat on CAT.ID_CATEGORIE = TAUX.ID_CATEGORIE
join DTP_SPE_TAUX_PERIODE per on PER.ID_TAUX_PERIODE = TAUX.ID_TAUX_PERIODE
join dtp_spe_employes2 emp on EMP.ID_AO_CONSORTIUM = con.ID_AO_CONSORTIUM and CAT.ID_CATEGORIE = EMP.ID_CATEGORIE

PROBLEM

The first 4 lines

1471 11015 Joe Billy 82.84 2010-04-01 2011-03-31 4474 2009-12-14 2010-04-29
1471 10989 Joe Billy 79.56 2008-04-01 2009-03-31 4474 2009-12-14 2010-04-29
1471 11020 Joe Billy 84.5 2011-04-01 2012-03-31 4474 2009-12-14 2010-04-29
1471 11007 Joe Billy 81.23 2009-04-01 2010-03-31 4474 2009-12-14 2010-04-29

It supposed to return me just the lines 1 and 4
I tried to use this

periode_debut_fac between periode_debut_tc AND periode_fin_tc
and
periode_fin_fac between periode_debut_tc AND periode_fin_tc


But not worked !! The only way that it worked was when I put this select inside another select, but after it the select get time to execut.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2011
Added on Nov 9 2011
4 comments
94 views