我有桌子
create table classroom(classID int, name nvarchar(50), year int)
create table subject(subjectId int, subjectName nvarchar(50) )
create table Approved(answerId int, total int, classID int,subjectId int)
我想获得一个查询,以便列出过去N年(从现在开始)考试的结果:
TITLE : # of students approved in : 15. History
classroom Name | 2013 | 2014 | 2015 | 2016 | 2017|
------------------------------------------------
1st grade | 10 | 20 | 5 | 20 | 30
2st grade | 3 | 50 | 5 | 60 | 40
3st grade | 10 | 20 | 7 | 20 | 30
是否有可能使用一个程序来获得此结果,该程序期望从当前的N年开始作为参数?