getting count from the same column in a mysql table?

后端 未结 4 805
野趣味
野趣味 2021-01-03 00:07

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

user{user_id, gender}

Gender can have obviously male or

4条回答
  •  萌比男神i
    2021-01-03 00:39

    try this: with total count:

    Select gender,count(*) as count
    From User
    Group by gender
    with rollup
    

    SQl Fiddle demo

提交回复
热议问题