I need to update sql statement with multiple rows. For example, the primary keys are Major and Study. The second column is a Value.
Primary Value
Major 10
Major 20
Study 01
Study 02
I need to keep the Primary Keys the same but change the Study Value field to the same as the Major Value
Primary Value
Major 10
Major 20
Study 10
Study 20
Here is the SQL I wrote
UPDATE SORXREF a
SET (a.SORXREF_EDI_VALUE) = (
SELECT DISTINCT b.SORXREF_EDI_VALUE
FROM SORXREF b
WHERE b.SORXREF_XLBL_CODE = 'STVMAJR')
/
Then I get the following error: single-row subquery returns more than one row
Primary Value
Major 10
Major 20
Study 01
Study 02
I need to keep the Primary Keys the same but change the Study Value field to the same as the Major Value
Primary Value
Major 10
Major 20
Study 10
Study 20
Here is the SQL I wrote
UPDATE SORXREF a
SET (a.SORXREF_EDI_VALUE) = (
SELECT DISTINCT b.SORXREF_EDI_VALUE
FROM SORXREF b
WHERE b.SORXREF_XLBL_CODE = 'STVMAJR')
/
Then I get the following error: single-row subquery returns more than one row