1

Topic: Interval choice by an amount of days and one date.

I welcome!
I ask to forgive if where already was similar.
Oracle 11g.
Request of a type:

with names
as (select to_date (' 9/5/2018 ', ' dd.mm.yyyy ') as dt from dual
union all
select to_date (' 9/3/2018 ', ' dd.mm.yyyy ') as dt from dual
union all
select to_date (' 9/1/2018 ', ' dd.mm.yyyy ') as dt from dual
union all
select to_date (' 9/7/2018 ', ' dd.mm.yyyy ') as dt from dual
union all
select to_date (' 9/9/2018 ', ' dd.mm.yyyy ') as dt from dual
union all
select to_date (' 9/10/2018 ', ' dd.mm.yyyy ') as dt from dual
)
select dt from names nn order by 1

Returns all dates :

DT
01-sen-2018
03-sen-2018
05-sen-2018
07-sen-2018
09-sen-2018
10-sen-2018

In the task of two parameters: finite date 09-sen-2018 and an amount of days 4
Prompt what request it is possible to receive, using initial parameters sampling:

DT
03-sen-2018
05-sen-2018
07-sen-2018
09-sen-2018

2

Re: Interval choice by an amount of days and one date.

sas_home;

wrote:

and an amount of days 4

Also what with them to do?

3

Re: Interval choice by an amount of days and one date.

sas_home;

SQL> ed
Wrote file afiedt.buf
1 with names
2 as (select to_date (' 9/5/2018 ', ' dd.mm.yyyy ') as dt from dual
3 union all
4 select to_date (' 9/3/2018 ', ' dd.mm.yyyy ') as dt from dual
5 union all
6 select to_date (' 9/1/2018 ', ' dd.mm.yyyy ') as dt from dual
7 union all
8 select to_date (' 9/7/2018 ', ' dd.mm.yyyy ') as dt from dual
9 union all
10 select to_date (' 9/9/2018 ', ' dd.mm.yyyy ') as dt from dual
11 union all
12 select to_date (' 9/10/2018 ', ' dd.mm.yyyy ') as dt from dual
13)
14 select dt from (
15 select dt from names nn
16 where dt <= date ' 2018-09-09'
17 order by dt desc)
18 where rownum <=4
19* order by 1
SQL> /
DT
--------
03.09.18
05.09.18
07.09.18
09.09.18
SQL>

....
stax

4

Re: Interval choice by an amount of days and one date.

And if dates are doubled?

5

Re: Interval choice by an amount of days and one date.

sas_home wrote:

And if dates are doubled?

    ?
....
stax

6

Re: Interval choice by an amount of days and one date.

sas_home;
Then DENSE_RANK to you in the help...

7

Re: Interval choice by an amount of days and one date.

Stax wrote:

it is passed...
    ?
....
stax

it is visible, the request returns 4-re lines, but smaller number of unique dates... It is thought, the person wants dense_rank in this case.

8

Re: Interval choice by an amount of days and one date.

Stax,     ?

9

Re: Interval choice by an amount of days and one date.

sas_home wrote:

And if dates are doubled?

a question, of course, rather ambiguous. It is possible to understand on a miscellaneous. But my understanding such: the link

10

Re: Interval choice by an amount of days and one date.

merch wrote:

Stax,     ?

   

11

Re: Interval choice by an amount of days and one date.

Anna wrote:

it is passed...
Question, of course, rather ambiguous. It is possible to understand on a miscellaneous. But my understanding such: the link

Understanding correct. Thanks! ! .