简单sql语法,求回帖!求解决!在线等!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
create table StuScore(ID int identity(1,1),[Name] varchar(20),Class varchar(20),Score int)truncate table StuScoreinsert into StuScore values('张春明','语文',89)insert into StuScore values('张春明','数学',97)insert into StuScore values('刘菲','数学',97)insert into StuScore values('刘菲','英语',20)insert into StuScore values('刘菲','语文',70)insert into StuScore values('吴京','语文',91)insert into StuScore values('吴京','英语',96)insert into StuScore values('袁磊','数学',84)insert into StuScore values('袁磊','英语',96)select * from StuScore
select *,ROW_NUMBER()over( ORDER BY 總分 desc) AS 名次 from (select [Name],SUM(Score) AS 總分 FROM StuScore GROUP BY [Name])tselect *,DENSE_RANK()over(ORDER BY 總分 desc) AS 名次 from (select [Name],SUM(Score) AS 總分 FROM StuScore GROUP BY [Name])tselect *,RANK()over(ORDER BY 總分 desc) AS 名次 from (select [Name],SUM(Score) AS 總分 FROM StuScore GROUP BY [Name])t