473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Percent of Males and Females and Age distribution

Hello,

I'm still using the older version of mysql 3.32 and I have a table,
which stores information about people, like their birthdate as a date
and their gender a smallint, which can be 0 meaning male or 1 meaning
female.

I need one select, which will return the percentage of males and
females and then I need a select, which will tell me how many people
are withing their teens, 20ths, 30ths and so on.

Is that even possible without subselects? And how do I get the total
number of rows in a table, disregarding any restrictions in the where
and having clauses?

Fritz

Feb 15 '06 #1
2 1792
On 15 Feb 2006 02:16:43 -0800, in mailing.database.mysql
"fr*********@web.de" <fr*********@web.de>
<11**********************@o13g2000cwo.googlegroups .com> wrote:
| Hello,
|
| I'm still using the older version of mysql 3.32 and I have a table,
| which stores information about people, like their birthdate as a date
| and their gender a smallint, which can be 0 meaning male or 1 meaning
| female.
|
| I need one select, which will return the percentage of males and
| females and then I need a select, which will tell me how many people
| are withing their teens, 20ths, 30ths and so on.
|
| Is that even possible without subselects? And how do I get the total
| number of rows in a table, disregarding any restrictions in the where
| and having clauses?


Sounds like a crosstab query will do the trick.
http://dev.mysql.com/tech-resources/...ard/index.html

---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Feb 15 '06 #2
<fr*********@web.de> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I need one select, which will ...


Why does this need to be a single query? Wouldn't it be easier to do this
in several queries, and then use application code to do the final
preparation into a report?

The solution is likely to be a very complex query. How much time will it
take you to develop and test this solution as a single query, versus as a
set of simpler queries?

Who would want to maintain such code? It would be a lot easier to maintain
a set of simpler queries, when the reporting requirements inevitably change.

Just food for thought.

Regards,
Bill K.
Feb 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: lkrubner | last post by:
I've come up with a non-frame version of this site: http://www.lauradenyes.com/ However, the owner doesn't like my version because the content in the center sits too high in the center part,...
4
by: MX1 | last post by:
Hi all, I've setup a table with one field that will hold percent values. The type is number and the format is percent on the field. When I do data entry directly into the field, I have to put...
1
by: Terencetrent | last post by:
I am trying to format a query expression drawn from a dialog box as percent. The original statement to get the value for the query is as follows: New%markup: !! The dialog box looks the...
3
by: Nothing | last post by:
This is going to be a really stupid question, but I am having a problem with the percent format in a control on a form. My end goal is that I want the user to enter 17 and have the control...
2
by: mhodkin | last post by:
I created a query in which I have grouped data by City. I wish to calculate the percent of each value, e.g. City/(Total count of all Cities), in tbe next column of the query. I can't seem to...
3
by: Ian Bell | last post by:
Hi All I have just upgraded to SQL2005 and found an annoying problem. Whenever I add a new view or amend an existing one (created in SQL 2000 Enterprise Manager) it inserts TOP 100 Percent into...
39
by: VidTheKid | last post by:
THE PROBLEM The % symbol is too vague when defining dimensions in CSS and HTML. It can relate to an inherited value, a measure of the containing element (which can differ between box models) or...
5
lee123
by: lee123 | last post by:
hi there i cant figure out how to get a percentage from a form i have created maybe one of you people can help me. the form i have has all of this on it: date,new orders,new, used,replacement...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.