Skip to content
Advertisement

getting count from the same column in a mysql table?

I wanted to a count of the same field for different values for example:

user{user_id, gender}

Gender can have obviously male or female ๐Ÿ™‚

i want to get count for all the males and females i.e.

but im confused because they come from the same gender coloumn thanks

Advertisement

Answer

Try this for row wise result:

Output:

Try this for row wise result with grand total:

Output:

Try this for column wise result:

Output:

See this SQL Fiddle

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement