Chandrashekar
3/30/2017 - 5:57 PM

Update QuestionWeightage SubsectionWeightage

Update QuestionWeightage SubsectionWeightage

------------------------------------------AuditTypeXQuestion-----------------------------------------------------------------
SELECT *
FROM [zImport_QWeightage] --52

SELECT a.QuestionWeightage
	,b.Weightage
FROM dbo.AuditTypeXQuestion a
INNER JOIN [dbo].[zImport_QWeightage] b ON a.AuditTypeId = b.AuditTypeId
	AND a.QuestionId = b.QuestionId

UPDATE a
SET a.QuestionWeightage = b.Weightage
FROM dbo.AuditTypeXQuestion a
INNER JOIN [dbo].[zImport_QWeightage] b ON a.AuditTypeId = b.AuditTypeId
	AND a.QuestionId = b.QuestionId

---------------------------------------------AuditTypeXSubsectionWeightage--------------------------------------------------------------
SELECT *
FROM [dbo].[zImport_SubsectionWeightage]

SELECT *
FROM dbo.AuditTypeXSubsectionWeightage a
INNER JOIN [dbo].[zImport_SubsectionWeightage] b ON a.AuditTypeId = b.AuditTypeId
	AND a.HierarchyNodeId = b.SubsectionId

UPDATE a
SET a.Weightage = b.Weightage
FROM dbo.AuditTypeXSubsectionWeightage a
INNER JOIN [dbo].[zImport_SubsectionWeightage] b ON a.AuditTypeId = b.AuditTypeId
	AND a.HierarchyNodeId = b.SubsectionId