I am creating a mysql statement that should update a table, but instead of setting a column name to be equal to some value the normal way, I decided to make it dynamic, for example instead of:
UPDATE mytable SET mycolumn = 'a value';
I use a variable. In this case:
SET @column = 'mycolumn';
UPDATE mytable SET @column = 'a value';
This returns a syntax error message when I execute the update statement. Is there a way to do this?