Talbe TA id name jobTable TBid job num SQL SERVER语法:select *,(select top 1 num from TB where job=TA.job) from TA 求教如何转为oracle 语句

解决方案 »

  1.   

    select * from table where rownum=1
      

  2.   

    select id, name, job from TA where id in
    (select id from (select id from TB order by num desc) where rownum=1);
      

  3.   

    Talbe TA  id name jobTable TBid job num  
    select [列名,列名],(select num from TB where job=TA.job and rownum <2) from TA  
    用 rownum  不是那样回报错要写成
    select a,b,c,d,(select 列 from 表)
      

  4.   

    select id, name, job from TA where job in
    (select job from TB) where rownum<2;
      

  5.   

    Key Words---RowNum
      

  6.   


    select t1.*,t2.num
    from TA t1,
    (select job,num from TB a where a.rowid = (select max(b.rowid) from TB b where b.job=a.job)) t2
    where t1.job=t2.job