select a1.name
from a1,a2
where substring(a1.id,1,4) = a2.aid
      and a2.aname = '2000级'

解决方案 »

  1.   

    select a.name from a where substr(to_char(a.id),1,4) = select to_char(b.id) from b where b.aname='2000级'
      

  2.   

    select a1.name  from a1,a2
    where substring(a1.id,1,4) = a2.aid
      

  3.   

    select a1.name  from a1,a2
    where substring(a1.id,1,4) = a2.aid
    and a2.aname = 你輸入的參數
      

  4.   

    select a1.name  from a1,a2 where substring(a1.id,1,4) = a2.aid and a2.aname ='2001级'
      

  5.   

    都写完了,来一个不一样的。select * from a1
    where substring(id,1,4) = (select aid from a2 where aname = '2001级')
      

  6.   

    select * from a1 where substr(a1.id,1,4) in (select a2.aid from a2 where a2.ananme='你的输入')
      

  7.   

    在sql*plus 中输入:accept var_aname 'please enter aname:'
    select a1.name
    from a1,a2
    where substring(a1.id,1,4) = a2.aid
          and a2.aname = '&var_name'
      

  8.   

    这样简单点:)select a1.name
    from a1,a2
    where substring(a1.id,1,4) = a2.aid
          and a2.aname = '&var_name'
      

  9.   

    select name from a1 where exists(select 1 from a2 where substr(a1.id,1,4)=a2.aid and a2.aname='...')