hi,
I got a table as an example for my problem:
theme /subtopic /partners
a / fish / cornershop
a / fish / supermarket
a / vegetables / supermarket
b / vegetables / cornershop
b / fruits / cornershop
c / fruits / cornershop
c / fruits / cornershop
c / fish / supermarket
First, I want to count the number of partners fro each subtopic. Second, I want to get the Average Number of partners per subtopic for each theme.
I started with this sql statement, but its not working:
Code:
SELECT theme, subtopic, Avg(t.NumberofPartners) AS Percentage_Partners
FROM (SELECT COUNT(partners) As NumberofPartners
FROM my_table
GROUP BY subtopic) AS t
GROUP BY theme;
Any Ideas?