Q
Problem solve Get help with specific problems with your technologies, process and projects.

Group aggregates as fractions of overall aggregate

I'm working on a Web-based poll where, among other things, you fill in your gender (m,f). I would like to construct...

an SQL query that calculates the fractions of males and females in my table. The following returns the absolute number of people of each gender but having it in fractions is something I don't know how to do.

SELECT gender, Count(*) AS Number
FROM mytable
GROUP BY gender;
This was last published in February 2003

Dig Deeper on Oracle and SQL

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close