Count maximum times record appears in Database table

后端 未结 2 411
你的背包
你的背包 2021-01-23 15:12

I am unable to find the proper mysql function but am trying to find the maximum number of a times a single record appears within a database relative to all other records.

<
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-23 15:19

    Can't nest directly, otherwise you'll get a grouped max. Nest the selects instead.

    select max(c) from (
      select
        count(*) c
      group by
        .. whatever ...
      ) x
    

提交回复
热议问题