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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL: how to use DATE to select last two weeks when the year changes (2006/2007)

Re: SQL: how to use DATE to select last two weeks when the year changes (2006/2007)

From: <joe1977_at_tlen.pl>
Date: 2 Jan 2007 19:29:57 -0800
Message-ID: <1167794997.589071.117720@48g2000cwx.googlegroups.com>


Charles Hooper wrote:
> joe1977_at_tlen.pl wrote:
> > how can one select or group records for last two weeks?
> > I used to do it (just for one year):
> >

This seems to imply that:
> TO_CHAR(CREATED, 'IW') >= (TO_CHAR(SYSDATE, 'IW')-2)
>
> Becomes:
> CREATED >= (TRUNC(NEXT_DAY(SYSDATE,'MONDAY')-7)-13)
>

thank you very much, that makes sense to me (and Oracle :))) Received on Tue Jan 02 2007 - 21:29:57 CST

Original text of this message

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