I have some duplicate account numbers but the codes are not. I’m trying to move each codes for the same account number into one field separated by commas
00629144 HAMR1
00629144 HUME2
Move the codes in the same row separated using a comma for the unique account number
00629797 HAMR, HUM
This is how I would do this in Access but I can’t figure it out on SQL Server,
SELECT QryAreasTS.ResourceID,
Concatenate("SELECT CharacteristicValue FROM QryZoneOnly WHERE ResourceID=""" & [ResourceID] & """")) AS Zones
FROM QryAreasTS
ORDER BY IIf([CharacteristicValue]=Null,"Manager",Concatenate("SELECT CharacteristicValue FROM QryZoneOnly WHERE ResourceID=""" & [ResourceID] & """"));
00629144 HAMR1
00629144 HUME2
Move the codes in the same row separated using a comma for the unique account number
00629797 HAMR, HUM
This is how I would do this in Access but I can’t figure it out on SQL Server,
SELECT QryAreasTS.ResourceID,
Concatenate("SELECT CharacteristicValue FROM QryZoneOnly WHERE ResourceID=""" & [ResourceID] & """")) AS Zones
FROM QryAreasTS
ORDER BY IIf([CharacteristicValue]=Null,"Manager",Concatenate("SELECT CharacteristicValue FROM QryZoneOnly WHERE ResourceID=""" & [ResourceID] & """"));