Display a query with name salary and commission for all employees
I have a question about SQL - this is my code so far:
SELECT ename,sal,comm
FROM emp
ORDER BY sal,comm desc;
WHERE comm>0;
I need to display the name, salary and commission for all employees who earn commission, and sort the data out in descending order开发者_StackOverflow中文版 of salary and commission.
You have an extra ;
in your query, and you need to rearrange things:
Select ename,sal,comm from emp order by sal,comm desc; where comm>0;
should be
Select ename,sal,comm from emp where comm>0 order by sal,comm desc;
you should use order clause at last
Select ename,sal,comm from emp where comm>0 order by sal,comm desc;
this should be your query also see here for further knowledge on this.
Select ename,sal,comm from emp where comm>0 order by sal,comm desc;
What about that?
精彩评论