Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2008
    Posts
    464

    Unanswered: Select..........9i

    Hi

    Was hoping someone could help me figure out the syntax to select the first 3 hours and the last 3 hours of the day for the last 30 days.

    Code:
    select * from table where datetime between trunc(sysdate)-30 and trunc(sysdate)
    gives me all 24hrs of each day.

    Regards
    Shajju

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    select *
    from table
    where datetime between trunc(sysdate)-30 and sysdate
    and to_char(datetime,'HH24') BETWEEN '00' AND '03'
    and to_char(datetime,'HH24') BETWEEN '21' AND '23'
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Aug 2008
    Posts
    464
    Many thanks beilstwh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •