日期:2014-05-16 浏览次数:20801 次
drop procedure test111; delimiter// create procedure test111() begin select count(*) into @n from t_custom_group order by id desc; set @i=1;set @str = '';set @tmp = '';set @strRet = ''; while @i <= @n do select @tmp := name from t_custom_group where LOCATE(concat(',',name,','), @str) = 0 order by id desc; set @str = concat(@str,',',@tmp,','); set @strRet = concat(@strRet,@tmp,','); set @i = @i+1; select @strRet; end while; end