SELECT *
  FROM (SELECT a.fid, b.fNAME, 
               row_number() over(PARTITION BY b.fid ORDER BY b.fname) rn
          FROM test1 a, test2 b
         WHERE a.fid = b.fid(+))
 WHERE rn=1很难很复杂。-_-!如果有简单版,告诉我一声。*^_^*

解决方案 »

  1.   

    select * 
    from project 
    left join project_file on project.id=project_file_id
    where rownum=1;
      

  2.   

    Select lt.project_id a,Count(lt.project_file_id) b
    From project lt,project_file lv
    Where lt.project_file_id=lv.project_id(+)
    Having Count(lt.project_id)=1
    Group By lt.project.id没分析过性能......
      

  3.   

    select * 
    from(
     select p.*, (
      select rowid from project_file f 
      where f.id=p.id and rownum=1
     ) r
     from project p
    )p
    inner join project_file f on p.r = f.rowid