1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Between 10:00 pm two days ago to 10:00 pm yesterday (24 hr period)

Discussion in 'SQL PL/SQL' started by Farshad Javadi, Feb 17, 2011.

  1. Farshad Javadi

    Farshad Javadi Active Member

    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    80
    Good morning all,

    How can I write an oracle SQL statement to compare my time field like below:

    NVL(TO_CHAR(cc_transaction.Createtime, 'YYYY-MM-DD HH24:MI'),'None') AS "Date and Time",


    To return value from 10:00 pm two days ago to 10:00 pm yesterday (24 hr period).


    Respectfully,
    Farshad
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,345
    Likes Received:
    347
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    Your WHERE clause would look like this:

    Where cc_transaction.Createtime between (trunc(sysdate -2)+22/24) and (trunc(sysdate -1)+22/24)
     
  3. Farshad Javadi

    Farshad Javadi Active Member

    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    80
    Thanks very much for your response. I really appreciate it.
    I learned from it. Thanks again.
     
  4. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Also find the other TRUNC options. This is just for your information.