刚才在数据库试了这个,报错:不是单分组函数
fno category id(表示:category的值)
1 类1 x1
1 类2 y2
1 类3 z3
2 类3 x4
2 类4 y5
2 类5 z6
2 类6 x7
3 类2 x8
3 类6 x9
请问该怎么转换成这种
fno 类1 类2 类3 类4 类5 类6
1 x1 y2 z3
2 x4 y5 z6 x7
3 x8 x9
查询语句:select fno,max(decode(category,'l1',value)) l1,max(decode(category,'l2',value)) l2,max(decode(category,'l3',value)) l3,max(decode(category,'l4',value)) l4,max(decode(category,'l5',value)) l5,max(decode(category,'l6',value)) l6 from table
fno category id(表示:category的值)
1 类1 x1
1 类2 y2
1 类3 z3
2 类3 x4
2 类4 y5
2 类5 z6
2 类6 x7
3 类2 x8
3 类6 x9
请问该怎么转换成这种
fno 类1 类2 类3 类4 类5 类6
1 x1 y2 z3
2 x4 y5 z6 x7
3 x8 x9
查询语句:select fno,max(decode(category,'l1',value)) l1,max(decode(category,'l2',value)) l2,max(decode(category,'l3',value)) l3,max(decode(category,'l4',value)) l4,max(decode(category,'l5',value)) l5,max(decode(category,'l6',value)) l6 from table
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货