I'm trying to concatenate the data after the pivot
select [ARC_ID]
from (select [MTD_ID],[ARC_ID],[MET_ARC_VALOR] from [dbo].[TB_BGP_METADATA_ARCHIVO])
as SourceTable pivot(MAX([MET_ARC_VALOR])
for [MTD_ID] in([1],[2],[3],[4],[5],[6])) as PivotTable
Order by [ARC_ID] asc;
I currently have this result:
|------|----------|----|-------|-----------|-----------|----------|
|ARC_ID|1 |2 |3 |4 |5 |6 |
|------|----------|----|-------|-----------|-----------|----------|
|105 |25.020.158|Casa|Prueba1|Certificado|cara\objeto|2011-07-06|
|------|----------|----|-------|-----------|-----------|----------|
I'm looking to do this:
|------|---------------|-----------------|------------------|-----------------|----------------------|-----------------|
|ARC_ID|1 |2 |3 |4 |5 |6 |
|------|---------------|-----------------|------------------|-----------------|----------------------|-----------------|
|105 |RUT: 25.020.158|Institucion: Casa|Documento: Prueba1|Tipo: Certificado|Direccion: cara\objeto|Fecha: 2011-07-06|
|------|---------------|-----------------|------------------|-----------------|----------------------|-----------------|