Jump to content

selecting, counting, and ordering similar data that exists


scarhand

Recommended Posts

lets say i have a table like this:

 

name | age | sex

mike | 22 | male

mitch | 21 | male

joan | 17 | female

john | 33 | male

 

and i want to select, count, and order all these results by sex (descending) without using any php variables to do so

 

and after they are selected, i am going to be putting them in an html table that will look like this:

 

sex | count

male | 3

female | 1

 

i have no idea where to get started...i can do the php on my own but i dont have any clue what to use for the select statement...im sure it will have to include SELECT, COUNT, WHERE, and GROUP BY but honestly im not sure.

 

any help would greatly be appreciated.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.