I found this query somewhere on the web, copied it to my notebook but part of it I never understood - why the two columns in parentheses? What does that accomplish?
select x.employeeid, y.thecount
from humanresources.employee x
join
(
select p.managerid, count(*)
from humanresources.employee p
group by p.managerid
) y (managerid, thecount) on y.managerid = x.managerid -