My statement:
Select deptno, job, avg (sal), avg (NVL (comm, 0))
Case avg (NVL (comm, 0))
The when avg (NVL (comm, 0)) & gt; 300 then 'bonus is good'
The when avg (NVL (comm, 0)) & gt; 100 and avg (NVL (comm, 0)) & lt; 300 then 'bonuses generally'
The when avg (NVL (comm, 0)) & lt; 100 then 'basic no bonus'
The else
End commstatus,
Group by deptno, job
The order by the deptno desc, job desc;
System tip: in line 3 & gt; Below a *, command not correct end
For everyone a great god grant instruction, thank you very much!!!!!
CodePudding user response:
Case behind the average can be removed, and then the else need to give a value or end directlyCodePudding user response:
Select deptno, job, avg (sal), avg (NVL (comm, 0))Case
The when avg (NVL (comm, 0)) & gt; 300 then 'bonus is good'
The when avg (NVL (comm, 0)) & gt; 100 and avg (NVL (comm, 0)) & lt; 300 then 'bonuses generally'
The when avg (NVL (comm, 0)) & lt; 100 then 'basic no bonus'
End commstatus,
Group by deptno, job
The order by the deptno desc, job desc;
CodePudding user response:
Thank you very much thank you very much!!!!!!