Tips-SQL排名次问题

--建立测试环境
--Create Table 表(name varchar(10),score varchar(10),semester varchar(10),place int)
--插入数据

--insert into 表
--select '张三:','87','1','' union
--select '李四:','90','1','' union
--select '王五:','91','1','' union
--select '刘海:','90','1',''

--测试语句
--update  表  set place =(select count(*)+1 from 表 where 表.score>a.score) from 表 a
--select * from 表
select score from 表
--select count(*)+1,name from 表 where score < any (select score from 表) group by name


 
 
--删除测试环境
--Drop Table 表

posted on 2005-11-20 16:11  Shooper .NET  阅读(739)  评论(1)    收藏  举报

导航