SQL Concatenate ids into a specific order
I have the following query which works great, it puts all my ids in a
comma separated list.
DECLARE @tmp nvarchar(max)
SET @tmp = ''
SELECT @tmp = @tmp + cast(id as nvarchar(max)) + ', '
FROM dbo.property
I want to put my ids in alphabetical order but when I add order by p.Name
it only gives my the top one result.
How can I adapt my query to accomplish this?
No comments:
Post a Comment