There is a special variable for current date, so that is easy. The
trick is converting your field into a date string representation.
This means inserting dashes between the year and month and day, since
SQL does not recognize just the digits as a valid string
representation. (See the SQL Reference section on string
representations of dates and times.)
If it is a character field, then do this, using an ISO representation
- no need to convert explicitly to a date:
select * from yourfile
where substr(datefld,1,4) || '-' || substr(datefld,5,2) || '-' ||
substr(datefld,7,2) >=
current date - 1 day
If the date field is numeric with 8 digits, use
digits(datefld) where I have "datefld" in the example.
At 06:19 AM 1/30/2006, you wrote:
Hi, I've got a file containing dates in yyyymmdd format. The date
contains entries that are about a year old. I want to use query, if
possible, to report on records where the dates are the current date
or the current date -1 (yesterday).
Does anyone have any examples of how this can be done?
Any help appreciated.
Thanks
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.