i am currently using SSRS and am having a few issues getting my head around something i am trying to achieve,
I have two joined tables, one a list of accounts and one a list of contacts. I am trying to show a count of accounts grouped by the number of contacts within that account.
I think what i am trying to do is this
select count(filteredaccount.accountid) as accounts, count(filteredcontact,contactid) as contacts
From FilteredAccount INNER JOIN
FilteredContact ON FilteredAccount.accountid = FilteredContact.accountid
group by count(filteredcontact.contactid)
but i can't do the group by, can anyone offer a solution. I have bodged it using the report tool to do the grouping but would like to know if it can be done in SQL only.

