Click here to Skip to main content
15,878,748 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Regards,

I have a table as below:
SQL
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]
Posted
Updated 11-Dec-12 12:23pm
v4
Comments
Richard MacCutchan 10-Dec-12 12:17pm    
I guess you did not notice that this is an English language forum.

1 solution

read my article here[^] on CodeProject.
Has explanation, samples etc.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900