求一查询语句,马上给分 怎样得出表按某字段降序排序后姓名为‘张三’的记录在降序表中的位置在第几? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select count(*) from 表名字 where 列名字> ( select 列名字 from 表名字 where name='张三') declare @t table(id int,name varchar(14))insert @t select 1,'李四'insert @t select 2,'张三'insert @t select 3,'李四B'insert @t select 4,'李四A'insert @t select 5,'李四C'insert @t select 6,'李四D'insert @t select 7,'李四E'insert @t select 8,'李四F'insert @t select 9,'张三H'insert @t select 10,'张三K'select id,name,排名=(select count(*)+1 from @t b where b.name>a.name) from @t a order by name desc------------------------id name 排名10 张三K 19 张三H 22 张三 38 李四F 47 李四E 56 李四D 65 李四C 73 李四B 84 李四A 91 李四 10 mysql添加索引时会不会加锁 怎样更新mysql数据库表中的索引 COUNT(DISTINCT(`id`)) 如何优化? mysql 宕机 如何快速把数据库的内容繁体转成简体? 怎样 将access 2000 数据库中的表的数据导入PostgreSQL中相应的表 unixODBC 和 MyODBC 之间的关系是什么? "can't create table "错误不解,在线等待 在linux下C语言调用的问题 求助恢复 苍天啊,为什么会出现这种问题~~~@_@ 麻烦啊。来帮帮我把。。。
insert @t select 1,'李四'
insert @t select 2,'张三'
insert @t select 3,'李四B'
insert @t select 4,'李四A'
insert @t select 5,'李四C'
insert @t select 6,'李四D'
insert @t select 7,'李四E'
insert @t select 8,'李四F'
insert @t select 9,'张三H'
insert @t select 10,'张三K'select id,name,排名=(select count(*)+1 from @t b where b.name>a.name) from @t a order by name desc------------------------
id name 排名
10 张三K 1
9 张三H 2
2 张三 3
8 李四F 4
7 李四E 5
6 李四D 6
5 李四C 7
3 李四B 8
4 李四A 9
1 李四 10