I'm working through an Oracle training manual. There's a exercise that asks for output like this:
Total Hires 1980 1981 1982
45 10 25 10
This is supposed to come from Emps. The book hasn't got to Nested columns yet (and I haven't learned this yet). I think the only way to get this is with subqueries hard coded for WHERE substr(HireDate,-2) = 80 etc.
Of course row, rather than column output is easy.
Select substr(HireDate,-2) "Year", Count(HireDate) "Number of Hires"
From Emp
Group by substr(HireDate,-2);
Is there some trick to getting columns for diffent "Grouping" values that I'm missing?
Total Hires 1980 1981 1982
45 10 25 10
This is supposed to come from Emps. The book hasn't got to Nested columns yet (and I haven't learned this yet). I think the only way to get this is with subqueries hard coded for WHERE substr(HireDate,-2) = 80 etc.
Of course row, rather than column output is easy.
Select substr(HireDate,-2) "Year", Count(HireDate) "Number of Hires"
From Emp
Group by substr(HireDate,-2);
Is there some trick to getting columns for diffent "Grouping" values that I'm missing?