SQL 

SQL 

使SQL

ranking 
CREATE TABLE ranking (
  id bigint(20) NOT NULL auto_increment,
  name varchar(20) NOT NULL,
  score bigint(20) NOT NULL,
);

SQL
SELECT
    r1.name,
    r1.score,
    (SELECT count(r2.score)
     FROM ranking as r2
     WHERE r2.score>r1.score)+1 as rank
FROM ranking as r1
ORDER BY r1.score DESC
LIMIT 10;

rank 


SQL 10LIMIT



MySQL 4.1 使


関連する投稿