on 2021 Sep 09 11:51 AM
I am trying to update TABLE2 from SCHEMA2 with Location values from TABLE1 from SCHEMA1 by SN and DATAID (the combination of SN and DATAID must be the same in order to update the location column) I've used the below code:
UPDATE "SCHEMA2"."TABLE2"
SET "LOCATION" = (SELECT LOCATION FROM "SCHEMA1"."TABLE1")
WHERE "SN" = (SELECT SN FROM "SCHEMA1"."TABLE1")
AND "DATAID" = (SELECT DATAID FROM "SCHEMA1"."TABLE1")
i have the following error: "SAP DBTech JDBC: [305]: single-row query returns more than one row" How can I resolve this?
Many thanks!
Request clarification before answering.
Have you tried something like this:
UPDATE T2 SET T2."LOCATION" = T1."LOCATION" FROM "SCHEMA2"."TABLE2" T2 JOIN "SCHEMA1"."TABLE1" T1 ON (T1."SN" = T2."SN" AND T1."DATAID" = T2."DATAID")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
52 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.