获取某一用户排行情况(mysql)

SELECT
	rank
FROM
	(
		SELECT
			(@ranknum :=@ranknum + 1) AS RANK,
			fk_login_id
		FROM
			(
				SELECT
					FK_LOGIN_ID
				FROM
					ddb_learn_log_day_trace
				WHERE
					study_date = '2019-06-11' order by count_time desc,fk_login_id desc ) c, (select(@ranknum := 0)) b ) e where e.fk_login_id='11'

你可能感兴趣的:(mysql)