Tuesday, 28 October 2014

How to calculate time based records in SQL

 Every 4 HOUR

/* Formatted on 10/28/2014 5:42:43 PM (QP5 v5.115.810.9015) */
SELECT   *
  FROM   PO_APPROVED_SUPPLIER_LIST
 WHERE   creation_date > (SYSDATE - INTERVAL '4' HOUR)

Every 5 HOUR




 SELECT   *
  FROM   PO_APPROVED_SUPPLIER_LIST
  WHERE CREATION_DATE > TRUNC(SYSDATE - 5 / 24, 'HH')

No comments:

Post a Comment