You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
574 B

6 years ago
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.game.persist.dao.GameUserJoinDao">
<select id="getRanking" resultType="int">
SELECT rowNo FROM
(
SELECT user_id,(@rowNum:=@rowNum+1) AS rowNo
FROM
(select user_id,score from t_game_user_join where rec_status = 0 and record_id = #{recordId,jdbcType=BIGINT}) a,
(SELECT(@rowNum:=0)) b
ORDER BY a.score DESC
) c
WHERE c.user_id= #{userId,jdbcType=BIGINT} limit 1
</select>
</mapper>