Tables:
- Activities: id, userId, description, buildingId
- Buildings: id, name
- User: id, name, gender
Users can create activities for example: “checking mail” would be an activity, the buildingid links to a building where a certant activity is going on.
What I need is a query that will get the % male/female per building, based of the amount of activities going on at such building.
For example:
User: 1, mike
Building: 1, main hall
Activities:
id: 1
userId: 1 (mike)
description: "checking mail"
buildingId: 1 (main hall)
id: 2
userId: 1 (mike)
description: "getting coffee"
buildingId: 1 (main hall)
So I want to get the % female / male of the building 1 (main hall) how can I do this the best way?
Or if you prefer ratio: