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



Does this work:

update F0901 F01 set F01.GMR001 =
(select F02.GMR001
from F0901T F02
where trim(f01.gmmcu)=trim(f02.gmmcu) and
f01.gmobj=f02.gmobj and
f01.gmsub=f02.gmsub)
where exists
(select F02.GMR001
from F0901T F02
where trim(f01.gmmcu)=trim(f02.gmmcu) and
f01.gmobj=f02.gmobj and
f01.gmsub=f02.gmsub)


Elvis

Celebrating 11-Years of SQL Performance Excellence on IBM i, i5/OS and
OS/400
www.centerfieldtechnology.com


-----Original Message-----
Subject: problem with update from select

Hi guys

I have one file (JDE) F0901 where many fields exist but I'm interested
in 4 fields:
GMMCU, GMOBJ, GMSUB - this is key
and data GMR001
(field GMMCU contain data right adjusted like ' 500')

and I have temporary file F0901T with "source of update", there are only
4 fields
GMMCU, GMOBJ, GMSUB, GMR001
like this
Business Obj Sub CAT
Unit Acct 1
------------ ------ -------- ---
000001 500 1610 H50000 MED
000002 500 1610 4260500 MED
000003 500 1612 H50000 VAC
(field GMMCU in second file contain data left adjusted like '500
')

Now I would like to update GMR001 in F0901 using data from F0901T

prepare this SQL code

update F0901 F01
set F01.GMR001 = (
select F02.GMR001
from F0901T F02
where
ltrim(rtrim(f01.gmmcu))=ltrim(rtrim(f02.gmmcu)) and
f01.gmobj=f02.gmobj and
f01.gmsub=f02.gmsub)
where
ltrim(rtrim(F01.gmmcu))!!F01.gmobj!!F01.GMSUB in (
select ltrim(rtrim(F02.gmmcu))!!F02.gmobj!!F02.GMSUB
from F0901T F02)

But when I calling I get error
Result of SELECT more than one row.
Message ID . . . . . . : SQL0811

How to change the sql code to do it correctly?

Regards

Tomek




As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.