select DEPARTMENT_ID, DEPARTMENT_NAME from DEPARTMENTS
union
select DEPARTMENT_ID, LAST_name from employees
order by 1, 2;
但基本上是以每个部门都有员工的方式订购......
答案 0 :(得分:0)
添加辅助排序以在部门组中首先强制部门行。
select 'D' as de, DEPARTMENT_ID, DEPARTMENT_NAME from DEPARTMENTS
union
select 'E' as de, DEPARTMENT_ID, LAST_name from employees
order by DEPARTMENT_ID, de, LAST_name ;