Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Percentage Count

Status
Not open for further replies.

Ali29J

Technical User
May 13, 2004
203
GB
Hi All

Quite a simple one i think, i have query which shows the number of quotes closed against a particular reason for closure as below

Code Qty
PTH 10
OTH 5

I would like to add an additional column to show this qty as a percentage of the total quotes
Code Qty %
PTH 10 66
OTH 5 33

Current SQL is below

SELECT InternalQuotes.InternalQuoteClosed, Count(InternalQuotes.InternalQuoteClosed) AS CountOfInternalQuoteClosed, InternalQuotes.CustomerID
FROM InternalQuotes
GROUP BY InternalQuotes.InternalQuoteClosed, InternalQuotes.CustomerID
HAVING (((InternalQuotes.CustomerID)=[forms]![frmCustomer]![CustomerID]));

Can anyone point me to a method of doing this??

 
Code:
select Code
     , Qty
     , 100.0 * Qty /
        ( select sum(Qty)
            from daTable )
         as percentage
  from daTable

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top