this is my query

```
select case t.type
when 'N' then  (select count(*) from table10_other)
when 'L' then (select count(*) from table11_other)
when 'P' then (select count(*) from table12_other)
end as nlp, t.* 
from table t  
left outer join employee e on e.emp_id = t.emp_id
left outer join table2 t2 on t2.code= t.code and d.year = t.year 
order by e.name

```

including the ORDER BY part significantly slows down my query.