I've been tasked with updating our Database by changing the value of the "value" column in the "ap_criteria" table from 0 to 1.
I have to change those values for a specific group that I get when executing this:
SELECT id, name, surname
FROM ap_volunteer
WHERE medical_certificate = 1
AND (id IN (SELECT DISTINCT(id_volunteer)
FROM ap_criteria
WHERE id_type = 177
AND value = '0'))
ORDER BY name ASC
I've had a few attempts but my limited experience with SQL is definitely showing. Here's my latest attempt :
UPDATE `ap_criteria`
INNER JOIN ap_volunteer ON ap_criteria.id_volunteer = ap_volunteer.id
WHERE medical_certificate = 1
AND (id IN (SELECT DISTINCT(id_volunteer)
FROM ap_criteria
AND id_type = 177 AND value = 0))
SET ap_criteria.value = 1
Unfortunately that one ended in failure! I'd appreciate if someone could help me out and point me in the right direction.
Thanks in advance!