;
WITH cte
AS (
SELECT u.UserName
,u.Email
,u.EmpId
--,ucxps.CenterXPGUXSkillId
--,a.AssessmentId
,a.AssessmentName
,asm.NAME AS AssessmentStatus
,ucxps.Rating
FROM dbo.[User] u
INNER JOIN dbo.UserXCenter ux ON u.UserId = ux.UserId
AND ux.IsActive = 1
LEFT JOIN dbo.UserCenterXCenterPguSkill ucxps ON ux.UserXCenterId = ucxps.UserXCenterId
LEFT JOIN dbo.Assessment a ON ucxps.Id = a.UserCenterXCenterPguSkillId
LEFT JOIN dbo.AssessmentStatusMaster asm ON a.AssessmentStatusId = asm.Id
WHERE u.EmpId IN (
''
)
)
SELECT *
FROM cte c
ORDER BY c.UserName