limiting records to yesterday 8pm data

Posted on 2011-04-28
Last Modified: 2013-12-18
I need to limit query to return records between yesterday 8 pm and day before yesterday 8pm

Ie select * from xyz where mydate between trunc(sysdate)_2  + 20hrs and sysdate _ 1 + 20 hrs
Please let me know how to do this..

Question by:gs79
    LVL 73

    Accepted Solution

    select * from xyz
    where mydate between trunc(sysdate) - 2 + 20/24 and trunc(sysdate) - 1 + 20/24
    LVL 76

    Assisted Solution

    by:slightwv (䄆 Netminder)

    select * from xyz where mydate between trunc(sysdate-1) + 20/24 and trunc(sysdate) + 20/24
    LVL 76

    Expert Comment

    by:slightwv (䄆 Netminder)
    I was off by a day and sdstuber beat me to it...  his is correct.

    Author Comment

    Spot on!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
    Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
    This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
    This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now