摘要: 生成sql代码 生成静态:select *from (select sname,[Course ] ='数学',[Score]=[数学] from Tb_students union allselect sname,[Course]='英语',[Score]=[英语] from Tb_students union allselect sname,[Course]='语文',[Score]=[语文] from Tb_students)torder by sname,case [Course] when '语文' then 1 whe 阅读全文
posted @ 2014-03-23 14:43 蜜雪粮液 阅读(45483) 评论(1) 推荐(1) 编辑
摘要: 一张表查询结果为--行转列select years,(select amount from Tb_Amount as A where month=1 and A.years=Tb_Amount.years)as m1,(select amount from Tb_Amount as A where month=2 and A.years=Tb_Amount.years)as m2,(select amount from Tb_Amount as A where month=3 and A.years=Tb_Amount.years)as m3from Tb_Amount group by .. 阅读全文
posted @ 2014-03-23 10:21 蜜雪粮液 阅读(1196) 评论(0) 推荐(1) 编辑