mysql行列转换(交叉表)的写法(二)

2014-11-24 03:13:10 · 作者: · 浏览: 13
087
END WHILE;
088
089
CLOSE cur;
090
091
set @v_result = CONCAT(v_1,', sum(if(code=\'total\',prices,0)) as \'total\'');
092
093
set @v_result = CONCAT(@v_result,v_2);
094
095
-- 执行sql
096
097
prepare stmt from @v_result;
098
099
EXECUTE stmt ;
100
www.2cto.com
101
deallocate prepare stmt;
102
103
end $$
哦了
call searchShuiguo () 就可以了
接下来添加一个新水果哈密瓜 试试

作者 夜聆风