另一个帖的答案
create table test
(IDno int identity(1,1) not null,
XSName varchar(20),
XPQTY int)insert test(XSName,XPQTY)
select '李全',67
union all select '付丽',457
union all select '陈林',379
union all select '李军',96
union all select '尹苏',877
union all select '徐华',788
go--/*
Select Identity(int,1,1) as 名次,xsname,xpqty Into #temptable From test order by xpqty desc
Select * From #temptable
Drop Table #temptable
--*/select * from test order by XPQTY descselect *,1+(select count(*) from test where XPQTY>a.XPQTY) as 名次
from test a
order by XPQTY descdrop table test
create table test
(IDno int identity(1,1) not null,
XSName varchar(20),
XPQTY int)insert test(XSName,XPQTY)
select '李全',67
union all select '付丽',457
union all select '陈林',379
union all select '李军',96
union all select '尹苏',877
union all select '徐华',788
go--/*
Select Identity(int,1,1) as 名次,xsname,xpqty Into #temptable From test order by xpqty desc
Select * From #temptable
Drop Table #temptable
--*/select * from test order by XPQTY descselect *,1+(select count(*) from test where XPQTY>a.XPQTY) as 名次
from test a
order by XPQTY descdrop table test
解决方案 »
- 求一sql語句
- sql 语句的问题
- 如何防止sql server因为程序上的不合理访问导致数据库缓慢?
- vb和sql server 2005怎么连接?
- 今天见鬼了,新装xp后,一个一定正确的程序连不上数据库,可是在odbc中配置一下就行了,然后我把dsn删了也还可以.??
- 无论怎样设置操作系统和sql的安全性,总有一个人可以随意操作?
- 请问能不能 约束 一个 整型 或 浮点 类型 字段 的 最小值 或 最大值 ????????
- 麻烦大哥大姐们帮我做下这题好吗?小妹感激不尽呀
- 无法打开多维数据集
- 关于mysql主键标识的问题?如何自动填充空白主键
- 难题SQL高手请帮忙
- 行列轉換 我怎么測試通不過呢
按点击率字段降序排列,把数据装到DataTable
循环DataTable到你要查的产品,并在循环中记录循环次数
不知道这样的方案合不合适咯!