0
回答
Mysql 查询 两个count 之后的排名
【腾讯云】学生服务器套餐10元/月 >>>   
+---------+----+------------+--------+---------------+------------+
| user_id | id | follow_uid | status | department_id | created_at |
+---------+----+------------+--------+---------------+------------+
| 1 | 1 | 1 | 2 | 1 | 1 |
| 1 | 2 | 2 | 2 | 1 | 1 |
| 1 | 3 | 3 | 2 | 1 | 1 |
| 2 | 4 | 4 | 2 | 1 | 1 |
| 3 | 5 | 4 | 2 | 1 | 1 |
+---------+----+------------+--------+---------------+------------+


怎么查出 user_id = 1 AND department_id = 1 的总记录数(count) 在 department_id = 1 里的排名是几?
举报
保密保密
发帖于3年前 0回/473阅
顶部