3

タイムスタンプが現在から過去 5 分の間にある行を選択する必要があります。どうすればいいのですか?そんな感じ:

select * from tableName where timestamp between sysdate and up to -5 min

シンプルであるほど良い。

4

2 に答える 2

8
select *
  from tableName
 where timestamp between sysdate and sysdate - interval '5' minute

または古いスタイル:

select *
  from tableName
 where timestamp between sysdate and sysdate - 5 * 60 / 86400
于 2011-09-14T23:04:01.867 に答える
0
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') NOW
,           to_char(sysdate - 1/24/12,'yyyy-mm-dd hh24:mi:ss') "5 min. before"
    from dual;

NOW                 5 min. before
------------------- -------------------
2011-09-15 15:11:06 2011-09-15 15:06:06
于 2011-09-15T13:12:31.083 に答える