Remove spaces via Update

2

I have a field called titulo , in the noticias table. Unfortunately, due to forgetting PHP's trim command, it has several titles with space at the beginning and end of the string . How can I via SQL (MySQL) update the titles by removing spaces at the beginning and end, in a single SQL command?

    
asked by anonymous 22.03.2016 / 16:01

1 answer

5

Using the TRIM() function:

UPDATE INTO noticiais SET titulo = TRIM(titulo);
    
22.03.2016 / 16:05