Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2011
    Posts
    3

    Question Unanswered: 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!

  2. #2
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •