Take the following code example. It should run directly in QA:DECLARE @mytable TABLE(FirstName VARCHAR(10),LastName VARCHAR(15))DECLARE @NameList VARCHAR(500)DECLARE @SortOrder SMALLINTSET @SortOrder = 1INSERT @mytable VALUES('Ralph','Johnson')INSERT @mytable VALUES('Suzie','Williams')INSERT @mytable VALUES('Jerry','Foster')INSERT @mytable VALUES('Robin','Griffin')INSERT @mytable VALUES('Todd','Smith')SELECT @NameList = ISNULL( @NameList + ',', '' ) + FirstNameFROM @mytableORDER BY FirstName/* Use this ORDER BY to see the weirdnessORDER BY CASE WHEN @SortOrder = 1 THEN FirstName ELSE LastName END*/SELECT @NameListAs written it works great - I get a comma-delimited list of first names. However, if I use the ORDER BY that is commented out instead, @NameList only includes the last value. I can't figure out why.3P==================================================Tolerance is the last virtue of an immoral society. -- G.K. Chesterton