×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Hi,

I'm tried to concatenate but I'm not able because it's numbers. It
returns an error saying that the concatenation is not allowed with the
operand sign



Obrigado,
Marco Silva


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: segunda-feira, 10 de Setembro de 2007 18:57
To: Midrange Systems Technical Discussion
Subject: Re: Create a field in AS/400 queries

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-2026 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.