|
I am trying to construct an UPDATE statement to update a single
column in a single row in table A with concatenated values from a
single column in multiple rows in table B. In googling the subject,
I have found a concept in MYSQL called Group_Concat that seems to
accomplish that task, although I only found examples where it was
used in Select statements, not Update statements. I looked in the
DB2 for i SQL reference and could find nothing about this concept.
Is there a way to accomplish this using DB2 for I SQL?? Below is
one of my attempts to try to use the Group Concat:
UPDATE MLPFLKSCD A
SET A. FSADIN =
GROUP_CONCAT(
SELECT B.FXDATA
FROM MLPFLOCKAD B
WHERE A.FSCMP=B.FXCMP AND A.FSLOC=B.FXLOC
AND A.FSFARMNO=B.FXFARMNO AND A.FSBARNID=B.FXBARNID
AND A.FSYEAR=B.FXYEAR AND A.FSNUM=B.FXNUM
AND A.FSPENID=B.FXPENID AND A.FSSEX=B.FXSEX
AND A.FSTSLT=B.FXTSLT AND A.FSSTDT=B.FXSDAT
)
As an Amazon Associate we earn from qualifying purchases.
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.