Comme je l'ai besoin gamme de données que je me sers BETWEEN
parce que, pour autant que je sache, ces deux questions ci-dessous devraient être les mêmes:ENTRE et les opérateurs de comparaison standard Oracle SQL
select * from table1 where my_date1 - my_date2 between (-1) and (-30);
et
select * from table1 where my_date1 - my_date2 <= (-1) and my_date1 - my_date2 >= (-30);
Cependant quand je l'essayer dans mon script:
SELECT
a.account_no AS ACCOUNT_NO,
a.installment_no AS INSTALLMENT_NO,
a.INSTALLMENT_DATE AS INSTALLMENT_DATE
FROM myTable a
INNER JOIN (SELECT
ACCOUNT_NO,
MIN(INSTALLMENT_NO) AS INSTALLMENT_NO
FROM myTable
WHERE
ACCOUNT_NO IS NOT NULL
AND INSTALLMENT_NO IS NOT NULL
AND STATUS = 'A'
GROUP BY ACCOUNT_NO) b
ON A.ACCOUNT_NO = B.ACCOUNT_NO AND A.INSTALLMENT_NO = B.INSTALLMENT_NO
WHERE (TRUNC(INSTALLMENT_DATE) - TRUNC(TO_DATE('12/01/2011','DD/MM/YYYY'))) BETWEEN (-1) AND (-30) -- If I change this
J'ai 0 lignes, mais quand je change
WHERE (TRUNC(INSTALLMENT_DATE) - TRUNC(TO_DATE('12/01/2011','DD/MM/YYYY'))) BETWEEN (-1) AND (-30)
à
WHERE (TRUNC(INSTALLMENT_DATE) - TRUNC(TO_DATE('12/01/2011','DD/MM/YYYY'))) <= (-1) and (TRUNC(INSTALLMENT_DATE) - TRUNC(TO_DATE('12/01/2011','DD/MM/YYYY'))) >= (-30)
Je reçois plus de 0 lignes. Je voudrais utiliser BETWEEN
car il est plus lisible. Est-ce que je manque quelque chose?