AleksTr
AleksTr

Reputation: 77

How find a data for the period?

How find a data for the period?

Example: the current date and time: 24.01.2017 12:15:00

Is there any way to do?

Upvotes: 0

Views: 36

Answers (2)

MT0
MT0

Reputation: 167972

SELECT *
FROM   your_table
WHERE  date_column BETWEEN SYSDATE - INTERVAL '15' MINUTE AND SYSDATE;

Upvotes: 1

You'd do something like

SELECT *
  FROM SOME_TABLE
  WHERE DATE_FIELD BETWEEN TO_DATE('24.01.2017 12:15:00', 'DD.MM.YYYY HH24:MI:SS')
                       AND TO_DATE('24.01.2017 12:00:00', 'DD.MM.YYYY HH24:MI:SS')

However, the above will return nothing because your end date is earlier than your start date. If you change your start and end dates around, however, and fix up the table and field names, you should be good.

Best of luck.

Upvotes: 1

Related Questions