我有一个表Commission_new作为Commission_new表的输出:
当我使用SQL时:
select * from
( select employee_no,years ,subtotal from
commission_new
)
pivot
( sum(subtotal) for years in (1999,2001,2000,2003)
--(select distinct nvl(years,0) from commission_new)
)
order by employee_no;
我得到结果
但是如果我使用
(select distinct nvl(years,0) from commission_test )
代替
(1999,2001,2000,2003)
我得到了错误:
第7行第7列错误:ORA-00936:缺少表达式
即使SQL select distinct nvl(years,0) from commission_test
给出相同的年份作为结果。
可能是什么原因?