select count(*) as count from table
group by foreign_id order by count
This returns a number of matches for each foreign id. However what im looking for is to summarise the results.
So the result would be:
10 results grouping 1 elements
5 results grouping 2 elements
7 results grouping 7 elements
Ok, got it. The title of the question expainls it better than the question itself 🙂
You need to first know how many times each FK appears:
Once you have this, you have to group them to get the amount of times each item appears the same way as above. This will result in:
See it in action here