473,473 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to select and count a field

123 New Member
i have a table called statue and a field called name and sex respectively, i have two male and two female under the field sex i what to select them and COUNT the number of male and female in the table statue and field sex and display there number.
Jul 21 '10 #1
3 2639
zorgi
431 Recognized Expert Contributor
You will need mysql commands COUNT and GROUP BY
Jul 21 '10 #2
simon2x1
123 New Member
Did you mean like this cause is still not working
Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(sex)WHERE sex = 'name' GROUP BY name 
  2.  
Jul 22 '10 #3
zorgi
431 Recognized Expert Contributor
More something like this:

SELECT sex, COUNT(name) FROM table_name GROUP BY sex
Jul 22 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: JP Belanger | last post by:
I have a question on select count(), which may betray my lack of database knowledge. Here goes. I have java code driving a transaction which goes like this: select count(*) from table ...
1
by: Hunter | last post by:
Hi group - I'm using php to extract data from postgres and print to browser. I have data that was input through checkboxes on a form - each checkbox had a different value but got pushed into the...
0
by: Fatt Shin | last post by:
Hi, I'm running MySQL 4.0.13, connecting from PowerBuilder 9 using ODCB Connector 3.51. I'm facing a problem where whenever I issue a SELECT COUNT(*) statement from PowerBuilder, I always get SQL...
0
by: - | last post by:
i have a query as follows and is unsure whether it is mysql or php: $result = mysqli_query("SELECT COUNT(*) > @foobar AS status ....") where it's suppose to get a one row value of either '0' or...
0
by: konsu | last post by:
hello, suppose a hypothetical table called 'table' with one field called 'field' of an arbitrary type. the query select count(*) from table where field='value' group by field produces no...
7
by: Paul Serby | last post by:
Why does '*select count(id) from "tblContacts"'* do a sequential scan when the field '*id*' is indexed using a btree? MySql simply looks at the index which is keeping a handy record of the...
4
by: Alec Christie | last post by:
Hi All, I want to Count the number of members in my database that have specific criteria, such as Blue eyes, or Brown hair. I have fields named Hair and Eyes, and others ofcourse, but I just...
5
by: Karl Irvin | last post by:
In VBA, how do you see the results of an sql count statement like the following ? Select Count (*) as Total from tblCustomer Result = DoCmd.RunSql("Select Count (*) as Total from...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
5
by: FFMG | last post by:
Hi, I was running a test on a table with 50000 rows. When I do: $sql = "SELECT * FROM TABLE"; $result = mysql_query($sql); $total = mysql_num_rows(result); I get a 'run out of memory...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
1
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.