Question: i've designed a organization table as per below:

```
Name          Supervisor     Manager
David            -            -
Josseph         David         -
Jenny           Josseph      David 
Step            Josseph      David
Mike            Josseph      David
steven          David

```

The Chart above explain that, David is at the highest position of the organization, Josseph and steven are report to David; Jenny, step and mike reporting to Josseph.

I would like to know how many person are reporting to David; and David is the manager to how many person? This is my expected table:

```
Supervisor    Manager
2            3

```

Can it be done with only 1 query?

Answer: 
It can:

```
select Name as BossName,
sum( case when Supervisor = Name then 1 else 0 end) as Supervises,
sum( case when Manager = Name then 1 else 0 end) as Manages
 from your_table group by Name;

```

This will get you something like:

```
BossName Supervises    Manages

David    2             3
Josseph  3             0
Jenny    0             0
....     0             0

```
Use the below query

```
select name,(select count(*) from <table> where supervisor=name) as supervisor,
(select count(*) from <table> where manager=name) as manager    
from <table>

```