sql - String length limit to minimum characters with MYSQL -
i need select subjects db.. used below code select coma separated list of subjects.
group_concat( distinct s.subject_name separator ', ') subjects, its ok. working me. output this.
mathematics, physiology, business & accounting studies, catholicism
now need limit string 35 characters , need add together '...' @ end of string.
it this.
mathematics, physiology, business... so, can know possible along mysql when select query?
thank you.
try this,
select if(char_length(subjects) > 35, concat(left(subjects,35), '...'), subjects), ... ( select group_concat( distinct s.subject_name separator ', ') subjects, ... tablename grouping ... ) s sqlfiddle demo i'd rather utilize char_length length when getting length of character because...
mysql sql
No comments:
Post a Comment