0

I have the tables

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)

I want to get a query so I can list the results of the exams from the last N years (from now):

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

Is it possible to get this results using a procedure that expects as parameter the last N years from the current one?

Flezcano
  • 1,647
  • 5
  • 22
  • 39

0 Answers0