select score
from user_userinfo aa
where exists(select count(*) from user_userinfo where score>aa.score)>99)
from user_userinfo aa
where exists(select count(*) from user_userinfo where score>aa.score)>99)
调试欢乐多
lsxaa(小李铅笔刀)我只有一个表!不是两个表!谢谢!
from user_userinfo aa
where (select count(*) from user_userinfo where score>aa.score)>99
或者这样 也行select top 1 score from user_userinfo
where score not in(select top 99 socre from user_userinfo order by socre desc)
order by score desc
top 1 只是得到最后一条记录,所以不对!谢谢!
需要实现的功能是:1:按分数排序
2:取出排名在第10位的用户的分数!
lsxaa(小李铅笔刀)
的两位子查询好像是不可以有order by 的!
lsxaa(小李铅笔刀)首先谢谢你们两位的回答,lsxaa(小李铅笔刀)取到的结果是最后一条记录,所以不对!bernice99(宝宝),你的语句无法通过调试,所以看不到结果,所以也不对!再次谢谢!
from user_userinfo aa
where (select count(*) from user_userinfo where score>aa.score)>99这个应该可以
是在用到比较符时才不可以!
我也写了一条可以用的!select top 1 score from user_userinfo
where siTestScore not in(
select distinct top 9 score from user_userinfo
order by score)
order by score
对了!那个 distinct是不要的!
select top 1 score from user_userinfo
where siTestScore not in(
select top 9 score from user_userinfo
order by score)
order by score
这样行吗?
select score from user_userinfo
where score in
(select top 10 socre from user_userinfo order by socre desc) and
score not in (select top 9 socre from user_userinfo order by socre desc)
where siTestScore not in(
select top 9 score from user_userinfo
order by score desc)
order by score desc
bernice99(宝宝) 你的非常正确,谢谢!to heibai520(Crazy Java) ,lsxaa(小李铅笔刀)
你们两个结果是一样的只是取到第一条记录,所以不对,总之谢谢你们的帮忙!
再次对所有人表示感谢!!!