Urgent : query to update a table referencing another table

Ask question on - DataBase Concepts, IBM Mainframe DB2, DB2/UDB, DB2 Tools, SQL , DB2 programming with languages like COBOL, PL1.

Moderators: Kalicharan, Moderator Group

Post Reply
vdhivya
Member
Posts: 1
Joined: Fri Mar 06, 2009 2:00 pm

Urgent : query to update a table referencing another table

Post by vdhivya » Fri Mar 06, 2009 2:06 pm

I have a table A in which I need to update a particular field for a list of Products. But the table A has multiple entries of the product. To find out the valid product, I need to check whether that prod is present in table B, if yes, then I have to update one filed of that product. Like this, I have a list of around 3000 products.

Could anyone please help me write the query?

UPDATE AB.ABPD1040 SET CNFIGR_SRC_CD=' '
WHERE PROD_ID IN (SELECT A.PROD_ID
FROM AB.ABPD1040 A,
AB.ABPD1030 B
WHERE A.PROD_ID = B.PROD_ID
AND A.SER_LTR = B.CURR_SER_LTR
AND A.PROD_ID IN ('XXXXX'
,'xxxxxx'..........................);

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Fri Mar 06, 2009 3:22 pm

your query will work... you want us to help in making a simple query.
Natarajan
Chennai

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others