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



Hi Everyone,

I am trying to write a SQL statement that will update the value of a table
with a value from another table. I can't seem to get DB2 to show me some
love. SQL isn't really my forte but I have done this before with MySQL and
it looks something like:

UPDATE WEBSPHERE/WEBINVF T1, WEBSPHERE/WEBUPCF T2 SET T1.UPC =
T2.VENDOR_S_ITEM WHERE T1.IOITEM = T2.ITEM AND T1.WEBSITEID = T2.WEBSITEID

Here are my attempts with DB2:

1. UPDATE WEBSPHERE/WEBINVF T1 SET T1.UPC = (SELECT T2.VENDOR_S_ITEM FROM
WEBSPHERE/WEBUPCF T2 WHERE ITEM = T1.IOITEM) WHERE T1.WEBSITEID = 1 AND
T2.WEBSITEID = 1 (This returns a column qualifier or table t2 undefined)

2. ***********RESULT OF SELECT MORE THAN ONE ROW.
UPDATE WEBSPHERE/WEBINVF T1 SET T1.UPC = (SELECT T2.VENDOR_S_ITEM FROM
WEBSPHERE/WEBUPCF T2 WHERE T2.ITEM = T1.IOITEM AND
T2.WEBSITEID=T1.WEBSITEID) WHERE T1.IOITEM IN (SELECT ITEM FROM
WEBSPHERE/WEBUPCF WHERE WEBSITEID = 1)


3. UPDATE WEBSPHERE/WEBINVF T1 SET UPC = (SELECT VENDOR_S_ITEM FROM
WEBSPHERE/WEBUPCF T2 WHERE T2.WEBSITEID = 1 AND T1.IOITEM = T2.IOITEM)AND
WEBSITEID = 1


4. UPDATE WEBSPHERE/WEBINVF T1 SET UPC = (SELECT T2.VENDOR_S_ITEM FROM
WEBSPHERE/WEBUPCF T2 WHERE T2.WEBSITEID = 1 AND T1.IOITEM = T2.ITEM AND
T2.VENDOR_S_ITEM !=' ' )

TIA,


Jason Taylor
Network Administrator
Mary Maxim, Inc.

e: jason@xxxxxxxxxxxxx
p: 810-987-2000 ext. 541
w: www.marymaxim.com






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.