[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Selecting a date that is 4 weeks prior to report date



Hi Joe,

Is the Date_ Report is Current Date ?

If it is Current date, the following method is easy.

Declare a date variable in Setup section and Use the dateadd function to add
or subtract the no. of days.
And use the newdate in your where clause.  Make sure the date format is the
same with your Database date format.

You can accomplish the Date from the record not more than 4 weeks prior to
the Report_Date (Current Date) with following example

Ex:

Begin-setup
 Declare-variable
  Date $datenew,$date_report
 End-delcare
End-setup

Begin-program
 Do main-processing
End-program

Begin-procedure main-processing
 -- if Date_report is Current_Date, use datenow() function
    let $Date_report = datenow()
 Let $datenew = dateadd($Date_Report, 'day',-28) - subtracts 4 weeks from
current date
Begin-select
Date_A
from Record_A
where Date_A >= $datenew  -- Make sure the Date format here.  If necessary
format it,
                                 -- as  ex: TO_DATE($datenew,'DD-MON-YY') or
whatever
end-select
end-proceduire

Hope this helps

raji
----------
From:  Joe [SMTP:jejohn1216@SURFREE.COM]
Sent:  Thursday, July 01, 1999 2:46 PM
To:  Multiple recipients of list SQR-USERS
Subject:  Selecting a date that is 4 weeks prior to report date

Hi all,

I need to select Date_A from a record where Date_A is no more than 4 weeks
prior to Date_Report.

The logic is

                  "select Date_A
                    from Record_A
                    where Date_A = Date_Report + 28 days"

What's the most efficient way to do this?

Thanks in Advance


~~ JEJ ~~   ;{)

--------------------------------------------------------
$14.95 Unlimited Internet Access, http://www.surfree.com