I have a mysql table that has a trigger that will activate when an update is performed. I would like to force this trigger to run by adding a value to the last name but only for specific users.
What I'm thinking is to make this work, I would need to take the value of the
lname and add something to it like '$'. This would make the trigger run and then rerun some SQL to remove the '$' from the
I think it would look something like this:
Update table set lname = (current_value_OF_LNAME & "$")
where active = 1
Update table set lname = (Remove($ from current_value_OF_LNAME)
Sorry for the pseudo code but I wanted to put this out there to see if this is the best way to do this or if there is a better way. Or if there is a way to just force this to run that would be acceptable too.
Thanks and sorry for the questions being muddy.
Something like this
Update table set lname = concat(lname,'$') where active = 1
Update table set lname = substr(lname,1,length(lname)-1) where active = 1
Are you alone on the DB or could more rows be added or updated. I hope not. If yes you may query like this (still not perfect but helps)
Update table set lname = substr(lname,1,length(lname)-1) where substr(test,-1) = '$'