Not sure if I understood your question correctly but if the amount of departments is fixed then you can try something like
select 1, dept_name from dept
union all
select 2, dept_name from dept where dept_name = 'hr'
union all
select 3, emp_name from emp where dept_name = 'hr'
union all
select 4, dept_name from dept where dept_name = '.net'
union all
select 5, emp_name from emp where dept_name = '.net'
order by 1, 2
If the amount of departments isn't fixed I suggest using a table valued function. For example, see
Using Table-Valued Functions in SQL Server[
^]