Home > Enterprise >  Remove last character from column's value if its comma
Remove last character from column's value if its comma

Time:09-30

Is it possible to remove last character from column's value only if the last char is comma ,

This will always remove last char:

select left(columnx,-1) from myTable;

Example input:

10,23,
11

Output should be:

10,23
11

CodePudding user response:

You can use trim:

trim(trailing ',' from '10,23,')
  • Related