I really think the question I have is not too specific, I just don’t know how to explain it.
Say I have a table with following Collumns
team | gameType | date | outcome
I would like to create a view that lists some statistics about the teams
SELECT team, count(*) as FROM matches GROUP BY team ORDER BY total DESC
Now I want to add columns counting the total
- which were league games
- which have been in the past month
- wins
- losses
- ties
The purpose is to create a view in the database, not any new tables or columns.
You can use case statements in your aggregation functions to aggregate only for specific events.