select name, score from student where score in
(select distinct top 3 score from student)
order by score desc 查出男女同学相同的班级??? 不明白你想找甚應.我是用 An Introduction to Database System (C.J. Date) 
每個 sql server都會詳細解釋的sql語法.

解决方案 »

  1.   


    是男女同学数目相同的班级你的AN INTORDUCTION TO DATEBASE SYSTEM 在哪有
      

  2.   

    select * from student where score in (select top 3 * from (select distinct score from student)as a order by a.score desc)
      

  3.   

    to:erickleung()
    书上的语法很简单,但与实际还是有差距
    至少要复杂一点
      

  4.   

    1、学习,原来TOP还可以这么用,:)
    2、我猜的,估计不行,:):
    select a.class from student a,student b 
    where (a.class=b.class) and (count(a.name)=count(b.name))
      and (a.sex="m" and b.sex="f")
      

  5.   

    1.
    select * from student t1,(select top 3 score from student group by score order by score desc)t2
    where t1.score=t2.score
    2.
    select class 
    from student 
    group by class
    having sum(case sex when 'f' then 1 else 0 end)=sum(case sex when 'm' then 1 else 0 end)
      

  6.   

    1见上
    2 提select class 
    from  student
    group by class  
    having sum(case when sex ='f' then 1 else 0 end)=sum(case when sex='m' then 1 else 0 end)
      

  7.   

    有意思,再来:
    select class 
    from student 
    group by class
    having sum(case sex when 'f' then 1 else -1 end)=0
      

  8.   

    select top 3 字段名 from 表名这样的语句在SYBASE数据库中好象不能用啊,:)