[AccessD] calculation

Drew Wutka DWUTKA at Marlow.com
Mon Jul 13 11:56:56 CDT 2009


This should do what you want:

SELECT T1.Patient, T1.B, (SELECT Count(*) FROM tblPatients WHERE
Patient=T1.Patient AND B=T1.B)/(SELECT Count(*) FROM tblPatients WHERE
Patient=T1.Patient)*100 & "%" AS Percentage
FROM tblPatients AS T1
GROUP BY T1.Patient, T1.B;

I made your table (with ID, Patient, B as the fields) and called it
tblPatient.

Drew
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Pedro Janssen
Sent: Monday, July 13, 2009 9:45 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] calculation

Hello Dan, and others.

i haven't got an query equation jet,
i can't seem to manage the group by calculation.

How i get 25%

Patient AA has 4  test (ID 1 to 4)
One of these has Value B=3.

calculation: 1 : 4 = 0,25    x 100% = 25%

Pedro



----- Original Message ----- 
From: "Dan Waters" <dwaters at usinternet.com>
To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
Sent: Monday, July 13, 2009 4:19 PM
Subject: Re: [AccessD] calculation


> Pedro,
>
> Can you post your equation?  I can't see how to get 25%.
>
> Also - what is B3?
>
> Dan
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
pedro at plex.nl
> Sent: Monday, July 13, 2009 3:55 PM
> To: accessd at databaseadvisors.com
> Subject: [AccessD] calculation
>
> Hello Group,
>
> i need to calculate the percentage(%) of the value B3 in access for
the
> total of numbers of B.
>
> The table that is have:
>
> ID    patient    B
> 1     AA         1
> 2     AA         1
> 3     AA         2
> 4     AA         3
> 5     BB         1
>
>
> Query:
>
> patient    B(%)
> AA         25
>
> How can i do this?
>
> Thanks
>
> Pedro
>
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the person or entity 
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business 
Sensitive material. If you are not the intended recipient, please contact the sender 
immediately and destroy the material in its entirety, whether electronic or hard copy. 
You are notified that any review, retransmission, copying, disclosure, dissemination, 
or other use of, or taking of any action in reliance upon this information by persons 
or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list