Could someone give me a hand with my code?
select nro_viaje
into #vviajes
from [ARROSWKS604\SQLEXPRESS].[Test].[dbo].[Hoja1$]
select nro_viaje, cod_cliente
into #cclientes
from [ARROSWKS604\SQLEXPRESS].[Test].[dbo].[Hoja1$]
Select distinct ST2.cod_cliente,
substring(
(
Select '-'+convert(varchar,ST1.cod_cliente) AS [text()]
From #cclientes ST1
Where ST1.nro_viaje = ST2.nro_viaje
ORDER BY ST1.cod_cliente
For XML PATH ('')
), 2, 1000) COMBINABLES
,(SELECT count(*) FROM #vviajes TMP2 WHERE ST2.nro_viaje = TMP2.nro_viaje GROUP BY nro_viaje)
From #cclientes ST2
The first column would show all the "customer_codes". What I try to do is show each of the "customer_codes" that made the same trip called "nro_viaje", but without the "customer_code" being repeated in the COMBINABLE field.
As I mentioned, the value of the column "customer_code" is repeated in COMBINABLES, which is what I do not want to appear.
Any help is useful!