set @x="'a','b','c','b'";
要得到
@x="'a','b','c'"
就是去除一个字符串变量中的重复内容
请问怎么样实现?

解决方案 »

  1.   

    create procedure killRepeat()
        begin
        declare i int;
        set @x="'a','b','c','b'";
        set i=0;
        set length=x.LENGTH-8;--求其长度
         declare temp varchar;
         temp='a';
         while i<length do
            if temp <> x.substring[i] then
               temp=temp.contact(temp,x.substring[i])
            end;
             set i=i+1;
         end while;
         end;//我未调试,会报错,我们再一同修改。
      

  2.   

    MYSQL中没有现成的语句或者函数来实现这个,需要或者如楼上的用存储过程,或者在你自己的程序中实现。