I have the FAULTS table with the following columns:
CREATE TABLE [dbo].[FALTAS](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Matricula] [int] NOT NULL,
[Dia] [date] NOT NULL,
[Situacao] [varchar](50) NOT NULL,
CONSTRAINT [PK_FALTAS] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Data:
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(31,'2014-06-11','FALTA');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(31,'2014-06-13','PRESENTE');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(31,'2014-06-12','FALTA');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(140,'2014-06-12','PRESENTE');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(140,'2014-06-11','PRESENTE');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(140,'2014-06-13','CURSO');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(200,'2014-06-11','CURSO');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(200,'2014-06-12','FALTA');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(200,'2014-06-13','PRESENTE');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(217,'2014-06-12','PRESENTE');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(217,'2014-06-13','FALTA');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(217,'2014-06-11','FALTA');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(223,'2014-06-11','PRESENTE');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(223,'2014-06-12','FALTA');
INSERT INTO FALTAS (Matricula,Dia,Situacao) VALUES(223,'2014-06-13','PRESENTE');
I need to show how:
Matricula 11/06/2014 12/06/2014 13/06/2014
31 FALTA FALTA PRESENTE
140 PRESENTE PRESENTE CURSO
200 CURSO FALTA PRESENTE
217 FALTA PRESENTE FALTA
223 PRESENTE FALTA PRESENTE
I know that the PIVOT operator changes the position of the row information to the column, but I could not find any examples without the use of aggregator (SUM, COUNT, etc.)