× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Marco,

This can be quite easily done in Query/400. However, I recommend you
create a "view" that does this. This will prevent you from having to put
this logic into every query that uses this combo.

Let's say I have a table that has these fields: myear, mmonth, mday (among
others).

If I do the following:
create view qtemp/marcol1 as (
select date(digits(myear) concat '-' concat
digits(mmonth) concat '-' concat
digits(mday)) as RealDate,
a.*
from qtemp/marco a)

I can now query this view, or logical file, in Query:
select *
from qtemp/marcol1
....+....1....+....2....+....3..
REALDATE MYEAR MMONTH MDAY
2006-05-01 2,006 5 1
******** End of data ********

This will save you from putting all that logic in every Query.

Again it is now a true date field:
select days(current date) - days(realdate) as AgingDays,
marcol1.*
from qtemp/marcol1
+....1....+....2....+....3....+....4....+...
AGINGDAYS REALDATE MYEAR MMONTH MDAY
497 2006-05-01 2,006 5 1
**** End of data ********



Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 by midrange.com 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.