days(current_date) - days(YOUR_DATE_FIELD) will give you the elapsed days.
Your problem may be that you're using CURRENT_TIMESTAMP rather than
CURRENT_DATE. The one you need to use depends upon the format of the field
you're comparing.


Jessica King
Client/Server Programmer

Manufacturing Performance Services, LLC
--A phelon Company--
895 University Parkway
Aiken, SC 29802
Phone: 803-649-1381

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Kelly Jones
Sent: Monday, June 26, 2006 2:39 PM
To: java400-l@xxxxxxxxxxxx
Subject: SQL DateAdd help needed

Hi group,
I have been banging my head into a wall.  At some point our "date"
functions changed on the iSeries with respect to SQL queries.  So now
every time I have to deal with them, I get a headache.
I'm trying to do a simply select stuff from table where datefield >
I've tried using dateadd(day, -30, current_timestamp) and
current_timestamp and many combinations thereof with no luck.  Could
somebody be kind enough and provide an actual working sql statement that
will give me a resultset for records between 30 days ago and now?  As an
FYI, I'm trying to run this from the Op Nav "Run A Script" interface.
The iSeries is on V5R3.
And as long as I'm asking, I will need a "datediff" statement after I
get this one figured out.  ;-)
Kelly Jones
Sr. Web Developer
Chef's Catalog
ph: (719) 272-2600
fax:  (719) 272.2601
email: kjones@xxxxxxxxxxxxxxxx
web: <> 

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.