Chandrashekar
10/30/2018 - 7:24 AM

Wave Transcript Report With Engineer Details

Wave Transcript Report With Engineer Details

DECLARE @waveId INT = 100

SELECT w.NAME AS Wave
	,CONVERT(NVARCHAR(500), a.AssessmentId) AS AssessmentId
	,p.NAME AS PGU
	,s.SkillName
	,qc.QuestionCategory AS Category
	,uaq.QuestionId
	,qm.QuestionText
	--,vam.Option_A
	--,vam.Option_B
	--,vam.Option_C
	--,vam.Option_D
	--,vam.Correct_Answer
	--,[dbo].[UDF_GetAnswerOptionsByCsvId](uaq.Answer) AS Marked_Ans
	,uaq.IsCorrect
	,uaq.ModifiedDate AS AttemptDate
	,at.AnswerType
	,u.UserName AS EngName
	,u.Email AS EngEmail
	,u.SecondaryRole 
FROM dbo.Assessment a
INNER JOIN dbo.UserAssessmentQuestion uaq ON a.AssessmentId = uaq.AssessmentId
	AND a.IsActive = 1
	AND a.AssessmentStatusId = 5
INNER JOIN dbo.QuestionMaster qm ON uaq.QuestionId = qm.QuestionId
--INNER JOIN dbo.vw_answer_master vam ON qm.QuestionId = vam.QuestionId
LEFT JOIN dbo.AnswerType at ON qm.AnswerTypeId = at.AnswerTypeId
LEFT JOIN dbo.QuestionCategories qc ON qm.QuestionCategoryId = qc.QuestionCategoryId
LEFT JOIN Wave w ON a.waveId = w.Id
LEFT JOIN dbo.PGU p ON qm.PGUId = p.PGUId
LEFT JOIN dbo.Skill s ON qm.SkillId = s.SkillId
LEFT JOIN dbo.UserCenterXCenterPguSkill ucxps ON a.UserCenterXCenterPguSkillId = ucxps.Id
LEFT JOIN dbo.UserXCenter ux ON ucxps.UserXCenterId = ux.UserXCenterId
LEFT JOIN dbo.[User] u ON ux.UserId = u.UserId
WHERE a.IsActive = 1
	AND a.WaveId = @waveId
	ORDER BY Wave, AssessmentId, PGU,s.SkillName,Category--46210