0

The problem is: I'm trying to find a value from one table where their vaccine choice is 'Janssen', I want the trigger to then copy their patient_id, the result of this will update the patient table and set the vaccination status to 'fully vaccinated' where it equals to the copied patient_id.

CREATE DEFINER = CURRENT_USER TRIGGER `database`.`patient_BEFORE_INSERT_1` BEFORE INSERT ON `appointment` FOR EACH ROW
BEGIN

IF NEW.vaccine_Choice = "Janssen" THEN

UPDATE patient
SET new.vaccination_Status = "Fully Vaccinated" 
where patient_id = new.patient_id;
 
END IF;
END

I'd appreciate your help!

1 Answer 1

2

Not SET new.vaccination_Status, SET patient.vaccination_Status

I would prefer to create a Stored Procedure that does whatever is needed to both tables, and maybe other tables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.