行と列をピボットするのが間違っていることを誰でも修正できますか?
--Trying to count no. of employees in each dept and pivoting it as deptno on columns and counts of no. of employees
-- rows
SELECT 10, 20, 30
FROM emp
PIVOT
(
count(deptno)
FOR empno IN ([10],[20],[30])
)
as pt
--Trying to sum of salary in each dept and pivoting it as deptno on columns and sum of salary of rows but same repeating nature
-- rows
SELECT 10, 20, 30
FROM emp
PIVOT
(
deptno(deptno)
FOR deptno IN ([10],[20],[30])
)
as pt