Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Easy way to select last 30 days based on DATE column?

Re: Easy way to select last 30 days based on DATE column?

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 22 Jul 2005 17:13:21 -0700
Message-ID: <1122077608.165661@yasure>


Rene Nyffenegger wrote:
> On 2005-07-22, Rhugga <chuck.carson_at_gmail.com> wrote:
>

>>I want to grab all rows from a table that have a DATE value within the
>>last 30 days. (thus it can span 2 months at any given time)
>>
>>Is this possible with a simple select or do I need to build more logic
>>in the application?

>
>
> It is indeed possible with a simple select and luckily, you need not build
> more logig in your application.
>
> select ...
> from ...
> where your_date_column > sysdate - 30;
>
>
> However, I don't understand why you equate 30 days with 2 months...
>
> hth
> Rene

What if the starting date is 31-January ... then it spans 3. ;-)

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Fri Jul 22 2005 - 19:13:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US