我必须按照以下规则对 EMPLOYEE 表中的员工进行排序:当他们的部门是 SALES 时,按经验排序,否则按 SALARY 排序
这是我尝试过的:
select FNAME||' '||LNAME as emp_name,salary,HIRE_DATE from employee
where dept_id=(select dept_id from department where name='SALES') order by HIRE_DATE asc;
UNION
select FNAME||' '||LNAME as emp_name,salary,HIRE_DATE from employee
where dept_id NOT IN (select dept_id from department where name='SALES') order by salary desc;
由于我认为有两个订单,这会引发错误。有什么解决办法吗?