I have this query that will return a list of all of the people associated with Thomas and their ids.

```
SELECT c.name,  c.ID
FROM namesandID s, associations o, namesandID c
WHERE s.name='Thomas' AND o.id = s.ID AND o.associateID = c.ID
GROUP BY c.ID;

```

Then I have this query that I can manually type in the id number and it will return the correct count of associates.

```
SELECT count(*) FROM (
    SELECT associateID FROM associations WHERE id=18827 GROUP BY associateID
) AS t;

```

My goal is to have one query that will take Thomas as the name and return three columns that will have his associate their id number an the number of people they are associated with.

Also as some additional information this is a very large database with about 4million rows and 300million associations so any speed increase on either of these queries would be greatly welcomed.