码迷,mamicode.com
首页 > 数据库 > 详细

经典sql总结(2)

时间:2014-09-29 12:54:30      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   ar   sp   div   2014   on   

bubuko.com,布布扣

 

如何做呢,跟上文区别不大。

我建个表,输入以下

 

bubuko.com,布布扣

1 select year,
2 (select amount from info2 as t2 where t2.year=t.year and t2.mouth=1) as m1,
3 (select amount from info2 as t3 where t3.year=t.year and t3.mouth=2) as m2,
4 (select amount from info2 as t4 where t4.year=t.year and t4.mouth=3) as m3
5 from info2 as t group by year;

 

经典sql总结(2)

标签:style   blog   http   color   ar   sp   div   2014   on   

原文地址:http://www.cnblogs.com/hansongjiang/p/3999763.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!