MySql,MsSql
[SQL] Ranking을 SQL로 구현
적샷굿샷
2013. 6. 28. 12:08
반응형
저장된 데이터
Select a.uid, a.user_score, count(a.uid) as ranking from tb_user_rank a, tb_user_rank b where a.user_score < b.user_score OR a.uid=b.uid GROUP BY a.uid ORDER BY ranking LIMIT 30
실행후 위와 같이 랭킹이 정리 되었습니다.
반응형