I have to separate and group the results of a query by year and by location. Both sources of information are in the same table. If I use group by
per year it combines all the locations, likewise the inverse one. I imagine that the solution is a query inside another but I do not find good examples of it.
When I write this code I receive the additional campuses disappear:
SELECT Course_Deliveries.year, Course_Deliveries.campus
FROM Course_Deliveries
GROUP BY year
However if I try to per campus then years disappear.
SELECT Course_Deliveries.year, Course_Deliveries.campus
FROM Course_Deliveries
GROUP BY campus
The required result is:
2016 Manawatu
2017 Auckland
2018 Manawatu
2018 Auckland
If I use GROUP BY year, campus
gives priority to one over the other.