MySQL – prepend a column

Sometimes it's nice to know of a hack to do something really simple, but also very useful. Such is the case with this one-liner that will add any character you want before (or after) the content in your column. For example, here's how to add an asterisk:

UPDATE table SET column = Concat('*', column)
UPDATE table SET column = Concat(column, '*')

Leave a Reply

Your email address will not be published. Required fields are marked *

Shares