DaveChoiceTech
asked on
SQL UPDATE QUERY PROBLEM
This is my problem
Table A has columns ID1,ID2 and NAME
Table B has columns ID1 and CATEGORY
Table C has columns ID1, ID2
B.CATEGORY can have the value X,Y and Z
A.ID2 has not had any values assigned
Step A: Get C.ID1, C.ID2 where C.ID1=B.ID1 and B.CATEGORY = 'X'
Step B: Update A.ID2 with C.ID2 where C.ID1 = A.ID1 for the records selected in step A
I am using DB2
Table A has columns ID1,ID2 and NAME
Table B has columns ID1 and CATEGORY
Table C has columns ID1, ID2
B.CATEGORY can have the value X,Y and Z
A.ID2 has not had any values assigned
Step A: Get C.ID1, C.ID2 where C.ID1=B.ID1 and B.CATEGORY = 'X'
Step B: Update A.ID2 with C.ID2 where C.ID1 = A.ID1 for the records selected in step A
I am using DB2
ASKER
I need to do this without creating an intermediate table.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect!
Open in new window
Step B: Update A.ID2 with C.ID2 where C.ID1 = A.ID1 for the records selected in step A
Open in new window
HTH,
DaveSlash