David542 David542 - 4 months ago 16
MySQL Question

How to do mysql rstrip

I have the following two values:

EN,
EN,FR


I want to change this to be as follows:

EN
EN,FR


How would I do the equivalent of:

str.rstrip(',')


in mysql?

Ray Ray
Answer

Use trim() and specify exactly what (in this case ,) and where (TRAILING, LEADING or BOTH):

  SELECT TRIM(TRAILING ',' FROM 'EN,');
Comments