Simple Trigger asistance!
Posted by:
Max Molina
Date: August 25, 2016 07:19PM
im Using phpMyAdmin to manage a DB for research in a Hospital, and I have almost everything set up, save for one thing.
When certain value on a column on my master_table is inserted/updated to 'yes', I need this record and its values from columns A,B,C,D etc... inserted into a new row in another table. So, I decided a trigger would bge perfect, since they work on insert, updates and deletes. Using mysql 5.7.
Don't suggest views, I don't need a view. I need a TABLE to handle this information, and for other developing purposes.
So, here it is >
BEGIN
IF
NEW.IMHQ_solicitada = Si THEN
INSERT INTO imhq SET RECORD_ID = NEW.RECORD_ID, Tipo_de_Estudio = NEW.Tipo_de_Estudio, Año = NEW.Año, Codigo_Interno = NEW.Codigo_Interno,Edad = NEW.Edad, Sexo = NEW.Sexo, V = NEW.Iniciales_del_ Px;
END IF;
END;
The missing code is generated by phpMyAdmin. This gives me A syntax error though. Any ideas?