mysql 排名

mysql 排名_第1张图片

SELECT b.company_hired_id  companyHiredId,b.geshu voteRecodeCount,rownum topNum FROM
    (
        SELECT t.*, @rownum := @rownum + 1 AS rownum
        FROM (SELECT @rownum := 0) r,
        (
         select company_hired_id,count(company_hired_id) geshu
         from botp_ceo_vote_recode
         group by company_hired_id
         order by geshu desc
        ) AS t
    ) AS b WHERE b.company_hired_id = 21

mysql 排名_第2张图片

你可能感兴趣的:(mysql)