Mysql, Concat on specified length -
i trying find way in mysql functions the following:
'ssssssttttttttrrrriiiinnnngggg' // have string i want take 10 letters concate '...'(3 dots), want concat strings on 10 letters example:
'123456string' // result: '123456stri...' 'strin6' // result: 'strin6' 'str123456ing' // result: 'str123456i...' 'asd23456' // result: 'asd23456' i trying substr, lpad , concat combinations, if got correct functions combination thankful, thank , have nice day.
select case when length(mystring) <= 10 mystring else concat(left(mystring, 7), '...') end mycol ...
Comments
Post a Comment