Aggregate functions in SQL, add 1 condition

Lifeseeker

Registered User.
Local time
Yesterday, 16:52
Joined
Mar 18, 2011
Messages
273
Hi,

I'm struggling with this aggregate function in SQL, and am wondering if someone could point me in the right direction.

The code is as follows:


SELECT Format(Sum(IIf(DateDiff("h",[start date],[abc_time])<=10,1,0))/Count([abc_test_done]),"Percent") AS PercentOfInterest
FROM tbl_record
WHERE (((tbl_record.abc_Test_Done)="yes"));

I simply want to do the exact same calculation for 2 different hospitals, but where would I add that location condition?

Shall I put in the WHERE clause? But then wouldn't I have to count the location as well for the numerator and denominator?

Please any comment/feedback is much appreciated.
 

Users who are viewing this thread

Back
Top Bottom