DECLARE @total_col VARCHAR(MAX) DECLARE @result NVARCHAR(MAX) SET @total_col='' SELECT @total_col = @total_col + QUOTENAME(item) + ',' FROM items SET @result=LEFT(@total_col, (LEN(@total_col)-1)) ...
Return the lastest inDate for each breed, but it is not pretty If you want to see the breed that was the most recent inDate for each pet type, then this will not return the results you want. MAX on ...