Hi All,
I'm very new to access and have been trying to teach myself as I go along, but am faced with an elementary task that I have been struggling with all day. My query below returns the correct counts by Payor for which I want to divide by the total number of records from table MHDCFY09A to get a percentage. As of now, the denominator, Expr1 returns the count of number of records in the table without the condition of hospid = 2118. Other than that Expr2 would seem to calculate the percent if I could fix Expr1..
SELECT PAYOR.PAYOR_DESC, Count(MHDCFY09A.PAYOR) AS PayorN, DCount("Hospid","MHDCFY09A","2118") AS Expr1, [PayorN]/[Expr1] AS Expr2
FROM MHDCFY09A INNER JOIN PAYOR ON MHDCFY09A.PAYOR = PAYOR.PAYOR
GROUP BY PAYOR.PAYOR_DESC, MHDCFY09A.HOSPID
HAVING (((MHDCFY09A.HOSPID)="2118"))
ORDER BY Count(MHDCFY09A.PAYOR) DESC;
Sorry if I described anything unclearly. Thanks for helping!!