An alias you define in the select clause (in this case Firstname and LastName) are not available for use in other columns in the select clause in the same query. So either you have to repeat your expressions (see 1 below), or make the query into a subquery (see 2 below)  Also, if there is a possibility that firstname or lastname can be null, you should account for that (see the second example)-------------- 1SELECT DISTINCT   nc_displayname AS DisplayName ,   nc_email AS Email ,   LEFT(nc_displayname, CHARINDEX(' ', nc_displayname + ' ') - 1) AS FirstName ,   CASE WHEN LEN(nc_displayname) - LEN(REPLACE(nc_displayname, ' ', '')) > 0        THEN PARSENAME(REPLACE(nc_displayname, ' ', '.'), 1)        ELSE NULL   END AS LastName ,   LEFT(nc_displayname, CHARINDEX(' ', nc_displayname + ' ') - 1)    + ',' +    CASE WHEN LEN(nc_displayname) - LEN(REPLACE(nc_displayname, ' ', '')) > 0        THEN PARSENAME(REPLACE(nc_displayname, ' ', '.'), 1)        ELSE NULL   END AS SearchNameFROM   ncos_domainuserORDER BY   NC_DisplayName    ---------- 2USE ncosgoSELECT * ,	   COALESCE(LastName ,'') + COALESCE(',' + FirstName,'') AS SearchNameFROM (	SELECT DISTINCT	   nc_displayname AS DisplayName ,	   nc_email AS Email ,	   LEFT(nc_displayname, CHARINDEX(' ', nc_displayname + ' ') - 1) AS FirstName ,	   CASE WHEN LEN(nc_displayname) - LEN(REPLACE(nc_displayname, ' ', '')) > 0			THEN PARSENAME(REPLACE(nc_displayname, ' ', '.'), 1)			ELSE NULL	   END AS LastName	FROM	   ncos_domainuser) s	 ORDER BY   NC_DisplayName