Adding a character to the end of a field using MYSQL

SQL

I was recently looking for a quick way to add a comma to the end of a MYSQL field. My first thought was to loop it through a PHP script and update the string for each field. This seemed like a long way round and I always love a good 1 line SQL statement fix so here it is.

update table set field = concat(field,’character to update’);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s