Link to home
Start Free TrialLog in
Avatar of lulu50
lulu50Flag for United States of America

asked on

Get the total of the count

Hi,

I have this query

select count(*) as Total, ST.ApplicationType,
cast(((count(*) * 100.0) / 741) as DECIMAL(10,2)) as Percentage from AppRepository AP
left join SourceType ST on AP.applicationType = ST.SourceID
where AP.Retired = 0
group by AP.ApplicationType, ST.ApplicationType

Open in new window


that generate this output

Total    ApplicationType                                        Percentage 
5	Access	                                                      0.67
21	Client	                                                      2.83
1	Crystal Reports	                                     0.13
303	Distributed	                                    40.89
25	Distributed/Mainframe	                   3.37
1	Function	                                                      0.13
242	Mainframe	                                     32.66
1	Other	                                                      0.13
24	Web - External/Distributed	                   3.24
76	Web - Internal/Distributed	                  10.26
41	Web - Internal/External -  Distributed	 5.53
1	Web - Internal/Mainframe	                   0.13

Open in new window



the problem that I am having is the percentage in my query I hard coded "741"
that supose to be the total of my cound and I don't know how to get it.

In my query I have the percentage:

cast(((count(*) * 100.0) / 741) as DECIMAL(10,2)) as Percentage

cast(((count(*) * 100.0) / ?????????) as DECIMAL(10,2)) as Percentage


741 is the sum of my count how can I do this

sum(count(*)) ?????

not sure please help
ASKER CERTIFIED SOLUTION
Avatar of Ray
Ray
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lulu50

ASKER

Ray!!!!

Thank you for your help

it works!!!!!!!!!!!!!!!!!!!!!!!!!!
Avatar of lulu50

ASKER

Thank you