 				FROM  [mhgr_eav].[dbo].[result_entities] features
 				INNER JOIN  [mhgr_eav].[dbo].[result_entities] snps ON snps.parent_id = features.id 
 				INNER JOIN  [mhgr_eav].[dbo].[attribute_relationships] ar ON ar.attribute1_id = snps.attribute_id
-					AND ar.relationship_id = 5     -- Variant of gene
-					AND ar.attribute2_id = 31      -- CYP2C19
+					AND ar.relationship_id = 5		-- Variant of gene
+					AND ar.attribute2_id = 31		-- CYP2C19
 				INNER JOIN  [mhgr_eav].[dbo].[result_entities] alleles ON alleles.parent_id = snps.id
-					AND alleles.attribute_id = 128 -- SNP allele
+					AND alleles.attribute_id = 128	-- SNP allele
 				WHERE features.attribute_id = 114   -- VCF Feature
 			) a
 			PIVOT ( MAX(value_short_text) FOR RowNum IN ([1], [2], [3], [4]) ) AS pvt

			[resulted_on]
		FROM
			(
				SELECT id,
				patient_id,
				snp_id,
				[1] AS value1,

				[4] AS resulted_on
			FROM
			(
				-- Grab resulted on date
				SELECT features.patient_id, features.id, snps.attribute_id AS [snp_id], CONVERT(VARCHAR, res_dt.value_date_time, 101) AS [value_short_text],
					4 AS RowNum
				FROM  [mhgr_eav].[dbo].[result_entities] features
				INNER JOIN  [mhgr_eav].[dbo].[result_entities] vcf ON vcf.id = features.parent_id
					AND vcf.attribute_id = 103		-- VCF result
				INNER JOIN  [mhgr_eav].[dbo].[result_entities] res_dt ON res_dt.parent_id = vcf.id 
					AND res_dt.attribute_id = 72	-- Reference bases
				INNER JOIN  [mhgr_eav].[dbo].[result_entities] snps ON snps.parent_id = features.id
				INNER JOIN  [mhgr_eav].[dbo].[attribute_relationships] ar ON snps.attribute_id = ar.attribute1_id
					AND ar.relationship_id = 5		-- Variant of gene
