I have many fields that contains extra space in start, like:
" RTX 3060"
-^
I want to remove first extra space from all fields of this table.
What I tried:
UPDATE table set field = concat( '', substring(field , 1)) where left(field ,1)=' ';
Return 0 result!
CodePudding user response:
Try with this statement, it will remove only the first space char of field is it's a space:
UPDATE `table`
SET column = SUBSTRING(column,2)
WHERE SUBSTRING(column, 1, 1) = ' ';
CodePudding user response:
Try using the LTRIM function. The syntax looks something like this:
UPDATE table SET column = LTRIM(column);