Get Questions with NA Categories
SELECT DISTINCT qm.QuestionId
--,qm.QuestionCategoryId
,qc.QuestionCategory
,s.SkillName
,p.NAME AS PGU
FROM dbo.UserAssessmentQuestion uaq
INNER JOIN dbo.Assessment a ON uaq.AssessmentId = a.AssessmentId
AND a.WaveId IN (
100
,103
)
INNER JOIN dbo.QuestionMaster qm ON uaq.QuestionId = qm.QuestionId
AND qm.IsActive = 1
AND qm.IsReviewed = 1
AND qm.CurrentLevelId = 5
INNER JOIN dbo.QuestionCategories qc ON qm.QuestionCategoryId = qc.QuestionCategoryId
AND (
qc.QuestionCategory = 'NA'
OR qc.QuestionCategory = 'N/A'
OR qc.QuestionCategory = 'Not Applicable'
OR qc.QuestionCategory = 'QuestionC_01'
OR qc.QuestionCategory = 'QuestionC_02'
OR qc.QuestionCategory = 'Default'
)
INNER JOIN dbo.Skill s ON qm.SkillId = s.SkillId
INNER JOIN dbo.PGU p ON qm.PGUId = p.PGUId
LEFT JOIN dbo.Wave w ON a.WaveId = w.Id
ORDER BY qm.QuestionId