网上的第51题
http://wenku.baidu.com/view/5897f82bcfc789eb172dc89c.html我的做法:
select * from 成绩表 where 分数 between (select 分数下届 from 等级表 where 级别='a') and (select 分数上届 from 等级表 where 级别='a')select * from 学生表 a join 成绩表 b on a.学号=b.学号 where b.分数>=(select 分数下届 from 等级表 where 级别='a') and b.分数<(select 分数上届 from 等级表 where 级别='a')感觉语句太长了,请假高手有没更精简的语句!!!

解决方案 »

  1.   

    select * from 成绩表, 等级表 where 分数 between 分数下届  and (select 分数上届  and  级别='a'
      

  2.   

    这样呢?
    select
       *
    from  
       成绩表a,等级表 b
    where 
       a.分数>=b.分数下届 and a.分数<=b.分数下届 and b.级别='a'
    and 
       a.学号=b.学号
      

  3.   

    (select 分数上届 and 级别='a'这个什么意识,怎么没from
      

  4.   

    语法写错了 select * from 成绩表, 等级表 where 分数 between 分数下届  and 分数上届  and  级别='a'