lo planteare lo mas claramente que se pueda.
Tengo una tabla con los campos periodo,monto y local
la idea es que tengo los cobros registrados asi
Cita:
periodo - monto- local- id
01/2007 - 10 - 01 - 002
02/2007 - 10 - 29 - 002
03/2007 - 20 - 70 - 002
.
.
.
12/2007- 26 - 74 - 002
12/2007 -75 - 74 - 002
01/2006 - 16 - 01 - 002
02/2006 - 18 - 29 - 002
03/2006 - 20 - 70 - 002
.
.
.
12/2006- 36 - 74 - 002
12/2006- 85 - 74 - 002
mas o menos asi...periodo - monto- local- id
01/2007 - 10 - 01 - 002
02/2007 - 10 - 29 - 002
03/2007 - 20 - 70 - 002
.
.
.
12/2007- 26 - 74 - 002
12/2007 -75 - 74 - 002
01/2006 - 16 - 01 - 002
02/2006 - 18 - 29 - 002
03/2006 - 20 - 70 - 002
.
.
.
12/2006- 36 - 74 - 002
12/2006- 85 - 74 - 002
De que forma podria hacer para meter esos datos en una tabla mas enfoque excel (bueno la denomino asi... en mi vocabulario jiji)
y los quiero pasar a esta forma...
Cita:
No se que tan claro se vea.. año - 01 - 02 - 03 .... 11 - 12
2007- 10 - 10 - 20 ... 26 - 75
2006 - 16 - 18 - 20 ... 36 - 85
2007- 10 - 10 - 20 ... 26 - 75
2006 - 16 - 18 - 20 ... 36 - 85
Estoy ideando algo asi....
Cita:
Pero bueno no estoy avanzando nada... creo... insert
tablaex
select '1992',
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='01/1992') as m1,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='02/1992') as m2,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='03/1992') as m3,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='04/1992') as m4,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='05/1992') as m5,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='06/1992') as m6,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='07/1992') as m7,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='08/1992') as m8,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='09/1992') as m9,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='10/1992') as m10,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='11/1992') as m11,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='12/1992') as m12
from temp123456 where substring(num_documento,5,7)='01/1992'
tablaex
select '1992',
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='01/1992') as m1,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='02/1992') as m2,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='03/1992') as m3,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='04/1992') as m4,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='05/1992') as m5,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='06/1992') as m6,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='07/1992') as m7,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='08/1992') as m8,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='09/1992') as m9,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='10/1992') as m10,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='11/1992') as m11,
(select rtrim(convert(char(10),monto))+' '+aportoen from temp123456 where substring(num_documento,5,11)='12/1992') as m12
from temp123456 where substring(num_documento,5,7)='01/1992'
Help me please..