Click here to Skip to main content
10,500,000 members (36,591 online)
Rate this:
 
Please Sign up or sign in to vote.
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]
Posted 10-Dec-12 4:21am
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

read my article here[^] on CodeProject.
Has explanation, samples etc.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.170924.2 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100