Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / October 2006

Tip: Looking for answers? Try searching our database.

Query to calculate the percentage

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cdolphin88@yahoo.co.uk - 04 Oct 2006 11:17 GMT
Hi,

I have a table with field physical damage (number) and this can be
either 0,1 or 2.

I need to calculate the percentage of occurrance for when is 1 and 2.

How should I do that? Can someone help me?

For example.

            Physical Damage           Percentage
0                     0                               0%

1                     2                               66.66%

2                     1                               33.33%

Cheers!

       C
John Spencer - 04 Oct 2006 13:21 GMT
You didn't give much detail on your table structure. Calculating the
percentage for the entire table should look something liek

SELECT [Physical Damage]
, Count([Physical Damage])/(SELECT Count( [Physical Damage]) FROM
[YourTable]) as Percentage
FROM [YourTable]
GROUP BY  [Physical Damage]

> Hi,
>
[quoted text clipped - 17 lines]
>
>        C
cdolphin88@yahoo.co.uk - 04 Oct 2006 13:58 GMT
I need to calculate the percentage for each "row", not the entire
table.
Let's say that I have 3 rows, I have 1 row with physical damage value =
2 and 2 rows with physical damage value = 1.

So the percentage for physical damage value = 2 should be
CountOfPhysicalDamageValue2/ Count(PhysicalDamage)  ---> 66.66%

So the percentage for physical damage value = 1 should be
CountOfPhysicalDamageValue1/ Count(PhysicalDamage) ---> 33.33%

Cheers!

     C

> You didn't give much detail on your table structure. Calculating the
> percentage for the entire table should look something liek
[quoted text clipped - 26 lines]
> >
> >        C
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.