So im trying to manipulate a db using SQLite Manager. Im trying to create a trigger that updates a field, based on another field being changed, and this is what I currently have
CREATE TRIGGER staff_update
AFTER UPDATE OF c_doctor ON tickets
WHEN OLD.c_doctor <> NEW.c_doctor
BEGIN
UPDATE tickets
SET c_doctor_staff_contact = doctor_staff_contact.c_doctor_staff_contact
WHERE NEW.c_doctor = doctor_staff_contact.c_doctor;
END
c_doctor is the name of the field in the tickets table as well as doctor_staff_contact table
doctor_staff_contact is also the name of a field in those tables as well
the duplicate naming convention was for ease of remembering for me
I've tried it with SET c_doctor_staff_contact = "test"; END and that works fine, so my assumption is = doctor_staff_contact.c_doctor_staff_contact WHERE NEW.c_doctor = doctor_staff_contact.c_doctor; END is giving me issues
Ive been looking up syntax on SQLite.org and as far as I can tell Im doing it right.
Aucun commentaire:
Enregistrer un commentaire