设为首页 加入收藏

TOP

mysql行列转换(交叉表)的写法(二)
2014-11-24 03:13:10 来源: 作者: 【 】 浏览:10
Tags:mysql 行列 转换 交叉 写法
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 () 就可以了
接下来添加一个新水果哈密瓜 试试

作者 夜聆风
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇linux上的mysql报Table 'xxx&.. 下一篇SQL优化建议备忘录

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·About - Redis (2025-12-26 08:20:56)
·Redis: A Comprehens (2025-12-26 08:20:53)
·Redis - The Real-ti (2025-12-26 08:20:50)
·Bash 脚本教程——Li (2025-12-26 07:53:35)
·实战篇!Linux shell (2025-12-26 07:53:32)