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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating percentages of total 1

Status
Not open for further replies.

nuct

Programmer
Sep 5, 2001
103

How do I make this...

GRADE DISABILITY NO DISABILITY
------ ---------- -------------
1st 0 1
2:1 2 8
2:2 3 8
3rd 5 0

into this...

GRADE DISABILITY NO DISABILITY
------ ---------- -------------
1st 0% 100%
2:1 20% 80%
2:2 27% 33%
3rd 100% 0%

Thanks in advance,

Simon.
 

Select
Grade,
100. * [Disabiity] / ([Disability] + [No Disability]) As DisabilityPercent,
100. * [No Disabiity] / ([Disability] + [No Disability]) As NoDisabilityPercent
From Table Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Hi, thanks for that, but do I need to create a view in order for this to work because this is how the select looks at the moment:

SELECT GRADE.GRADE_NAME "GRADE",
SUM(DECODE(S_SEX,'M',1,0)) "MALE",
SUM(DECODE(S_SEX,'F',1,0)) "FEMALE"

Thanks,

Simon.
 
Ok, no problem i get it now

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top