Home » SQL & PL/SQL » SQL & PL/SQL » Selecting a Specific date/time Range (Oracle 11, Linux)
Selecting a Specific date/time Range [message #584113] Wed, 08 May 2013 14:39 Go to next message
tgreen1
Messages: 13
Registered: December 2012
Junior Member
I want to select a specific date/time range in a query. I want to select from 6 AM yesterday through 6 AM today. I know that CURRENT_DATE - 1 will give me yesterday, and I can search between that and the current_date. However, how do I incorporate the specific time in the query? Any suggestions are appreciated...

Thanks.
Re: Selecting a Specific date/time Range [message #584114 is a reply to message #584113] Wed, 08 May 2013 14:48 Go to previous messageGo to next message
BlackSwan
Messages: 22724
Registered: January 2009
Senior Member
select * from table1 where your_date between trunc(sysdate-1)+0.25 and trunc(sysdate)+0.25;

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: Selecting a Specific date/time Range [message #584115 is a reply to message #584114] Wed, 08 May 2013 14:53 Go to previous messageGo to next message
tgreen1
Messages: 13
Registered: December 2012
Junior Member
Thanks! I will give this a try.
Re: Selecting a Specific date/time Range [message #584123 is a reply to message #584115] Wed, 08 May 2013 15:50 Go to previous messageGo to next message
joy_division
Messages: 4504
Registered: February 2005
Location: East Coast USA
Senior Member
And if you want to use some other times, realize that you just have to use a fraction, with 24 being the denominator and the hour being the numerator (if you want to use by the hour). Change denominator to 1440 if you plan on drilling down to the minute.
Re: Selecting a Specific date/time Range [message #584124 is a reply to message #584123] Wed, 08 May 2013 16:02 Go to previous message
tgreen1
Messages: 13
Registered: December 2012
Junior Member
Great, thanks!
Previous Topic: how to remove duplicate rows from table
Next Topic: Help for Regular Expressions.
Goto Forum:
  


Current Time: Mon Sep 01 14:31:23 CDT 2014

Total time taken to generate the page: 0.09710 seconds