If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Query previous week in Informix

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-08-11, 08:28
kaledev kaledev is offline
Registered User
 
Join Date: Jun 2011
Posts: 3
Question Query previous week in Informix

I have a report that is running a query to pull data for the previous 7 days, as shown below in the WHERE clause:

Code:
AND rpt.act_ingate_dtm  > TODAY - INTERVAL(7) DAY TO DAY
AND rpt.act_ingate_dtm < TODAY
This is always run on Sunday morning currently....but I need to be able to run it any day of the week and have it always pull from the previous week (Sunday through Saturday). Can anyone help me set this up for Informix specifically?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 06-15-11, 05:48
AlenaR AlenaR is offline
Registered User
 
Join Date: Jun 2011
Posts: 1
a

What about try something like this:
AND rpt.act_ingate_dtm > TODAY - INTERVAL(7-mod(weekday(today),7)) DAY TO DAY
AND rpt.act_ingate_dtm < TODAY - INTERVAL(mod(weekday(today),7)) DAY TO DAY



Quote:
Originally Posted by kaledev View Post
I have a report that is running a query to pull data for the previous 7 days, as shown below in the WHERE clause:

Code:
AND rpt.act_ingate_dtm  > TODAY - INTERVAL(7) DAY TO DAY
AND rpt.act_ingate_dtm < TODAY
This is always run on Sunday morning currently....but I need to be able to run it any day of the week and have it always pull from the previous week (Sunday through Saturday). Can anyone help me set this up for Informix specifically?

Thanks!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On