I want to update the values of a column with the values that I have acquired through a select statement. But by performing the select I have the whole set of the results, which I want each one of them to be replaced by the czi_first_name_en (kind of a foreach loop) This is what is have so far:
UPDATE citizen_info t
SET t.czi_first_name_en=
(
SELECT per_username
FROM person
INNER JOIN enrollment_office
ON person.per_id=enrollment_office.eof_manager_id
INNER JOIN card_request
ON enrollment_office.eof_id=card_request.crq_enroll_office_id
INNER JOIN citizen
ON card_request.crq_citizen_id=citizen.ctz_id
INNER JOIN citizen_info
ON citizen.ctz_id=citizen_info.czi_id
WHERE person.per_dep_id=card_request.crq_enroll_office_id) AS person_username
How must I proceed?