I have a PHP app that inserts ‘Pass’, ‘Fail’ or ‘NA’ into fields TEST1, TEST2, TEST3… through TEST15.
I have a field called OVERALL that needs to be automatically updated with ‘FAIL’ if any of the TEST1-TEST15 fields contains ‘Fail’.
I’m pretty sure I need to use a trigger containing the update statement and either CASE or IF, but I haven’t been able to nail down the exact syntax.
Can anyone please help a MySQL noob? I’m using MySQL Server version: 5.1.63-0+squeeze1 (Debian).
You could probably do something like
This is what such a trigger could look like in theory, however I must say i’m not a 100% on the syntax since its been a while since i worked on mysql.
You can check the manual for more infos on the trigger
http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html