I have a table in mysql: (_table) with a a few columns, one of which includes a block of text. I want to search the column with the block of text (text) to see if it includes specific text [JOB]. If it does, I’d like to insert Y in another column (data). Or, if it includes [JOB-M] I’d like it to insert M in the previously mentioned column (data), If it contains neither [JOB-M] or [JOB], then it should insert N. I’d like it to follow this process every time the field (text) is updated or inserted.
I gather I need to create a stored procedure and a trigger, but am having a lot of trouble… any hints?
-Nat
p.s. I know how to do this in excel, but transferring this over to mysql has been troublesome. Here is my excel formula:
=IF(ISNUMBER(SEARCH("[JOB]",X6)),"Y",IF(ISNUMBER(SEARCH("[JOB-M]",X6)),"M", "N"))
An INSERT trigger and an UPDATE trigger will do the trick: