Subject | Updating values in a table with vals from a related table |
---|---|
Author | Clay Shannon |
Post date | 2005-02-21T15:29:29Z |
I need to set the vals of a column in one table to that in another table's
column. Neither of the following works, though:
1.
UPDATE PATIENTS
SET PATIENT_ID = PATIENT_ADMISSIONS.ADMISSION_ID
WHERE PATIENT_ADMISSIONS.PATIENT_ID = PATIENTS.PATIENT_ID
("column unknown - patient_admissions.admission_id (there is such a
table.column in the DB)")
2.
UPDATE PATIENTS P
SET PATIENT_ID =
(SELECT ADMISSION_ID
FROM PATIENT_ADMISSIONS A
WHERE P.PATIENT_ID = A.PATIENT_ID)
("multiple rows in singleton select")
I used some syntax that was either identical or nearly identical to this a
few days ago in a similar situation, and that worked. What has gone awry in
the mean time? Is it "Monday malady"?
Clay Shannon,
Dimension 4 Software
[Non-text portions of this message have been removed]
column. Neither of the following works, though:
1.
UPDATE PATIENTS
SET PATIENT_ID = PATIENT_ADMISSIONS.ADMISSION_ID
WHERE PATIENT_ADMISSIONS.PATIENT_ID = PATIENTS.PATIENT_ID
("column unknown - patient_admissions.admission_id (there is such a
table.column in the DB)")
2.
UPDATE PATIENTS P
SET PATIENT_ID =
(SELECT ADMISSION_ID
FROM PATIENT_ADMISSIONS A
WHERE P.PATIENT_ID = A.PATIENT_ID)
("multiple rows in singleton select")
I used some syntax that was either identical or nearly identical to this a
few days ago in a similar situation, and that worked. What has gone awry in
the mean time? Is it "Monday malady"?
Clay Shannon,
Dimension 4 Software
[Non-text portions of this message have been removed]