本帖最后由 tianxiapwq 于 2013-09-12 10:20:29 编辑

解决方案 »

  1.   

    (select stuid from a  where a.classd=b.classd and stulb='01' order by rtime desc) x 这个要加上表b才行吧。
      

  2.   

    select case
             when b.classd = '001' then
              (select stuid
                 from (select stuid
                         from a
                        where a.classd = classd
                          and stulb = '02'
                        order by rtime desc) x
                where rownum = 1)
             when b.classd = '002' then
              (select stuid
                 from (select stuid
                         from a
                        where a.classd = classd
                          and stulb = '01'
                        order by rtime desc) x
                where rownum = 1)
             else
              '0'
           end as zzrx
      from b
      

  3.   

    但是我这边10g可以执行,11g提示b.classd 不明字符
      

  4.   

    可能case层里的classd根本就取不到b表的,只是a表的两个对等
    不知道是不是这样,等大神解答