Is there a quick way of running a query to select records based on” current sysdate – 1″ i.e yesterday.

150 pts.
Tags:
AS/400 Query
Query
Is there a quick way of running a query to select records based on current sysdate - 1 ie yesterday. Using Martin Gilbert's suggestion I get the current date & it works perfectly CD CHAR(CURRENT(DATE)) CURDAT SUBSTR(CD, 1, 2) || SUBSTR(CD, 4, 2) || SUBSTR(CD, 7, 2) Then use CURDAT in your selection However I want to do the comparison to always include today & yesterdays data. Thanks
ASKED: June 23, 2008  2:27 PM
UPDATED: June 23, 2008  3:57 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

You should be able to use the following :-

YD char(current(date) – 1 DAYS)

YESDAT SUBSTR(YD, 1, 2) ||
SUBSTR(YD, 4, 2) ||
SUBSTR(YD, 7, 2)

Hope this helps,

Martin Gilbert.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following