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

    Unanswered: Selecting one hour each day.....9i

    Hi

    Could someone help me write the syntax to extract only one hour (say 5pm) for the previous 7 days?

    E.g.,
    Code:
    How would I write the SQL for:
    
    select * from TABLE where datetime is 5pm (only) for dates between 25 OCT 2011 & 30 OCT 2011.
    Regards
    Shajju
    Last edited by shajju; 10-31-11 at 02:49.

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Something like this?
    Code:
    select *
    from table
    where date_column between to_date('25.10.2011', 'dd.mm.yyyy')
                          and to_date('30.10.2011', 'dd.mm.yyyy')
      and to_char(date_column, 'hh24') = '17';

  3. #3
    Join Date
    Aug 2008
    Posts
    464

    Thanks

    Much Appreciated...

Posting Permissions

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