Oracle——distinct的用法

--工号,姓名,所属公司id,所属公司,部门id,部门,直属部门,岗位,直接上级,工作地点,职级,安全级别

 1 select distinct a.loginid,a.lastname,a.subcompanyid1,e.subcompanyname,
 2 b.id,
 3 b.departmentname,
 4 sys_connect_by_path(b.departmentname , '\') as a,
 5 c.jobtitlename,
 6 (select lastname from hrmresource where a.managerid=id ),
 7 d.locationname,a.joblevel,a.seclevel
 8 from  hrmresource a ,HrmDepartment b,HrmJobTitles c,HrmLocations d,hrmsubcompany e
 9 where a.departmentid=b.id and a.jobtitle=c.id and a.subcompanyid1=e.id
10 and a.locationid=d.id and a.status in(0,1,2,3) 
11 start with b.supdepid =0
12 connect by prior b.id= b.supdepid 
13 order by  a.subcompanyid1,b.id,a.loginid

 

posted on 2014-10-22 14:27  诗意盎然  阅读(224)  评论(0)    收藏  举报

导航