I am attempting to get two counts and then divide those two counts to get the ratio of the items I am counting. I saw this post here and tried that. I am getting an error in my
The structure of your query bothers me. You can do it much more efficiently as:
SELECT A.NUMer, A.DENOM, cast(A.NUMer as float)/A.DENOM
FROM (SELECT COUNT(case when drg_no IN (061,062,063,064,065,066) then DRG_NO
end ) as Numer,
count(case when drg_no IN 061,062,063,064,065,066,067,068,069) then DRG_NO
end) as denom
FROM smsdss.BMH_PLM_PtAcct_V
WHERE drg_no IN (061,062,063,064,065,066)
AND Adm_Date BETWEEN @SD AND @ED
AND PLM_PT_ACCT_TYPE = 'I'
) a
This doesn't affect the integer divide issue, but your original query is overcomplicated.