larrydavid
Programmer
Hello,
Within a greater select, I need to calculate a value based on a numerator and denominator as follows:
So the output I'm looking for is the [Count 1] / [Count 2]
(1532375 / 5857895).
I need to divide the two results from the temp tables and am not quite sure what the best approach is. This will be one of several other values within a main select statement.
Any help would be greatly appreciated.
Thanks,
Larry
Within a greater select, I need to calculate a value based on a numerator and denominator as follows:
Code:
--numerator: denied claim
DROP TABLE #dcn
SELECT COUNT(tc.CLAIMNO) as dcn_count
INTO #dcn
FROM TEST_CLAIMS tc
WHERE tc.STATUS IN ('02','91')
AND (tc.AMT1 = 0 AND tc.AMT2 = 0 AND tc.AMT3 = 0)
--denominator: paid claim
DROP TABLE #dcd
SELECT COUNT(tc.CLAIMNO) as dcd_count
INTO #dcd
FROM TEST_CLAIMS tc
WHERE tc.STATUS IN ('02','91')
AND (tc.AMT1 > 0 OR tc.AMT2 > 0 OR tc.AMT3 > 0)
select dcn_count from #dcn (result = 1532375)
select dcd_count from #dcd (result = 5857895)
So the output I'm looking for is the [Count 1] / [Count 2]
(1532375 / 5857895).
I need to divide the two results from the temp tables and am not quite sure what the best approach is. This will be one of several other values within a main select statement.
Any help would be greatly appreciated.
Thanks,
Larry