Regards,
I have a table as below:
create table #t (
Factura varchar(15),
ReciboCaja varchar(15),
ReciboCajaValor varchar(15),
)
insert into #t values('1', '1', '1')
insert into #t values('1', '2', '2')
insert into #t values('1', '3', '3')
insert into #t values('2', '4', '1')
insert into #t values('2', '5', '1')
insert into #t values('3', '6', '1')
insert into #t values('3', '7', '1')
insert into #t values('3', '8', '1')
I need that through a dynamic pivot deliver me the following result
Factura ReciboCaja1 ReciboValor1 ReciboCaja2 ReciboValor2 ReciboCaja3 ReciboValor3
1 1 1 2 2 3 3
2 4 1 5 1 null null
3 6 1 7 1 8 1
Thanks in advance.
[Edit]Changed Spanish text into English text (using Google Translate)[/Edit]