Thank you all for your reply the previous sql statement worked!
Many thanks for your responses!...
User Profile
Collapse
-
Sorry I need to correct something in my previous post!
Due to my select statement containing multiple columns it was giving me the error.
I have retested by using the select statement, selecting only that column. After that it ran but it updated all fields in the table rather then just the fields for which we ran a select.
Back to square one -((
Could it be at all related to the fact I am running...Leave a comment:
-
Hi,
Thanks for your reply.
When I try to run the query as per your above example I get an error SQL0412 "Subquery with more then one result column not valid."
UPDATE TABLE_HDR
SET HDRFIELD1 = 'XX'
WHERE HDRFIELD1 IN (SELECT HDRFIELD1 FROM TABLE_HDR,TABLE _1A,TABLE_1B WHERE FIELD_1A= FIELD_1B AND HDRFIELD1=FIELD 1A)
(result set of the select is 21 rows for which I...Leave a comment:
-
MARIEDB2 started a topic Help: UPDATE FIELD WHERE CONDITION BASED ON SELECT QUERY FROM MULTIPLE TABLES.in DB2Help: UPDATE FIELD WHERE CONDITION BASED ON SELECT QUERY FROM MULTIPLE TABLES.
Hello,
I am struggling to build a query on a DB2 db wich does an update for multiple fields which are the result of a select query with where clause (using multiple tables in the condition).
E.g.
UPDATE TABLE_HDR
SET HDRFIELD1 = 'XX'
WHERE EXIST
(SELECT HDRFIELD1 FROM TABLE_HDR,TABLE _1A,TABLE_1B WHERE FIELD_1A= FIELD_1B AND HDRFIELD1=FIELD 1A)
I always get the same result...
No activity results to display
Show More
Leave a comment: