Create a filter of 90 days before a period

1

I need you to bring results that have completed 90 days within an informed period.

For example, I have the possibility to do:

DT_INICIO_REAL <= (sysdate-90) , will result in 90 days from the current date

or DT_INICIO_REAL BETWEEN :DT_INICIO AND :DT_FIM I will have results from the informed period.

But I need to "merge" the two things, I want you to enter a period, for example 01/10/2017 to 10/10/2017 and bring me the lines where DT_INICIO_REAL completes 90 days within the reported period. / p>     

asked by anonymous 30.10.2017 / 16:34

1 answer

2

What about:

SELECT
    *
FROM
    TABELA
WHERE
    DT_INICIO_REAL BETWEEN to_date('01-OCT-2017') and to_date('10-OCT-2017') AND
    (trunc(sysdate) - DT_INICIO_REAL) >= 90;

See working in SQLFiddle

    
30.10.2017 / 17:04