the two tables match the creation_date The same is true.
I am using the following query, but I receive an error-“Nearby” is “: Syntax error”.
What’s wrong with the query?
Update test_test as Tinner join (select id,patient_id,creation_date from test_groupedconsent) as Aon A.patient_id = T.patient_id and A.creation_date = T.creation_dateset T.testconsent_id = A.id;
You have to use a correlated subquery to find the value you need (in the subquery, you can do anything, but in this case, you don’t even need to connect):
< /p>
UPDATE test_test
SET testconsent_id = (SELECT id
FROM test_groupedconsent
WHERE patient_id = test_test.patient_id
AND creation_date = test_test.creation_date);
I have to update the test_test column “testconsent_id” with the id value of the table test_groupedconsent, where the patient_id in test_test matches the patient_id in the test_groupedconsent table, and
the two tables match the creation_date The same is true.
I am using the following query, but I receive an error-“Nearby” is “: Syntax error”.
What’s wrong with the query?
Update test_test as Tinner join (select id,patient_id,creation_date from test_groupedconsent) as Aon A.patient_id = T.patient_id and A.creation_date = T.creation_dateset T.testconsent_id = A.id;
You cannot directly use the connection in the UPDATE statement.
You must use the related subquery to find The desired value (in the subquery, you can do anything, but in this case, you don’t even need to connect):
UPDATE test_test
SET testconsent_id = (SELECT id
FROM test_groupedconsent
WHERE patient_id = test_test.patient_id
AND creation_date = test_test.creation_date);