select score 
from user_userinfo aa
where exists(select count(*) from user_userinfo where score>aa.score)>99)

解决方案 »

  1.   

    to
     lsxaa(小李铅笔刀)我只有一个表!不是两个表!谢谢!
      

  2.   

    select top 1 score from user_userinfo where exists(select * from user_userinfo order by score asc,name desc)
      

  3.   

    select score 
    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
      

  4.   

    select top 1 score from user_userinfo where exists(select top 100 from user_userinfo order by score asc,name desc)
      

  5.   

    楼是的!子查询是不可是有order by 的!
      

  6.   

    to   bernice99(宝宝)是第10名或第一百名的用户的分数,所以只有一条记录!
    top 1 只是得到最后一条记录,所以不对!谢谢!
    需要实现的功能是:1:按分数排序
                      2:取出排名在第10位的用户的分数!
      

  7.   

    to:bernice99(宝宝)
      lsxaa(小李铅笔刀)
    的两位子查询好像是不可以有order by 的!
      

  8.   

    to  bernice99(宝宝) 
         lsxaa(小李铅笔刀)首先谢谢你们两位的回答,lsxaa(小李铅笔刀)取到的结果是最后一条记录,所以不对!bernice99(宝宝),你的语句无法通过调试,所以看不到结果,所以也不对!再次谢谢!
      

  9.   

    select score 
    from user_userinfo aa
    where (select count(*) from user_userinfo where score>aa.score)>99这个应该可以 
      

  10.   

    对不起是我记错了!是可以的!
    是在用到比较符时才不可以!
    我也写了一条可以用的!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
      

  11.   

    我的那条试过了!是可以的!你可以试试!
    对了!那个 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
      

  12.   

    对不起!我错了。
    这样行吗?
    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)
      

  13.   

    又少了一个关键字DESC,这样就可以了!select top 1 score from user_userinfo 
    where siTestScore not in(
    select top 9 score from user_userinfo  
    order by score desc)
    order by score desc
      

  14.   

    to
     bernice99(宝宝) 你的非常正确,谢谢!to heibai520(Crazy Java) ,lsxaa(小李铅笔刀)
    你们两个结果是一样的只是取到第一条记录,所以不对,总之谢谢你们的帮忙!
    再次对所有人表示感谢!!!