Posted on:

21 Nov 2024

0

Id like to ask if this is ok.

select * from (select t1.emp_no as emp, t2.dept_no as dept ,
(select emp_no from dept_manager where emp_no = 110022) as manager
from employees as t1 
join
dept_emp as t2  on t1.emp_no = t2.emp_no
where t1.emp_no  <= 10020 or t1.emp_no = '110039'
group by t1.emp_no, t2.dept_no
order by emp) as A
union
select * from (select t1.emp_no as emp, t2.dept_no as dept ,
(select emp_no from dept_manager where emp_no = 110039) as manager
from employees as t1 
join
dept_emp as t2  on t1.emp_no = t2.emp_no
where t1.emp_no between '10021' and '10040' or t1.emp_no = '110022'
group by t1.emp_no, t2.dept_no
order by emp) as b
order by emp;
0 answers ( 0 marked as helpful)

Submit an answer