不知道效率怎么样……set timing on
Select a.class,a.name,
       Max(decode(a.subject,'语文',a.scores)) 期末语文,
       Max(decode(a.subject,'数学',a.scores)) 期末数学,
       Max(decode(a.subject,'政治',a.scores)) 期末政治,
       Max(decode(b.subject,'语文',b.scores)) 期中语文,
       Max(decode(b.subject,'数学',b.scores)) 期中数学,
       Max(decode(b.subject,'政治',b.scores)) 期中政治
From a,b
Where a.name=b.Name And a.Name='王1' 
Group By a.class,a.name

解决方案 »

  1.   

    decode不能用吧?他不一定是数字啊
      

  2.   

    不是 group by 表达式
      

  3.   

    有什么问题么???
    哪个不是group by表达式?
      

  4.   

    执行的时候提示,去掉group by,提示错误,非单组分组执行函数
      

  5.   

    你是用上面的代码吗?不可能啊,max加了么?
    把你执行的代码贴出来看看