Hello,
I have the following query:
select *
from
(select pre_sap_cod
from pre
)
pivot
(
count(pre_sap_cod)
for pre_sap_cod in ('1' , '3')
);
This is working fine,I get what I want:
'1' | '3'
8708 | 281259
But there are more values that 1 and 3, and if I try to do this;
select *
from
(select pre_sap_cod
from pre
)
pivot
(
count(pre_sap_cod)
for pre_sap_cod in (select distinct pre_sap_cod from pre)
);
I get the error message: ORA-00936: missing expression
What I can do?. I am using Pivot because I want the information in columns.
Thanks in advance.