Chinaunix首页 | 论坛 | 博客
  • 博客访问: 788269
  • 博文数量: 142
  • 博客积分: 10288
  • 博客等级: 上将
  • 技术积分: 2905
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-03 13:19
文章分类

全部博文(142)

文章存档

2019年(2)

2009年(51)

2008年(89)

分类: 数据库开发技术

2009-04-03 10:19:32

with tempDeptName(deptName) as
(
      select
             dept_name as deptName
     from
             bas_dept as dept,tpp_materialmuster as muster
     where
             dept.DEPT_ID = muster.NEEDUNIT
           
     union all
     
     select
             corp_name as deptName
     from
              bas_corp as corp,tpp_materialmuster as muster
     where
             corp.corp_id = muster.NEEDUNIT
           
),
tempProjInfo(projName, projCode) as
(
      select
             etfprojName as projName,
            etfprojCode as projCode
     from
             tbi_etfproj as etf, tpp_materialMuster as muster
     where
             etf.etfprojid = muster.projid
           
     union all
     
     select
             etmprojName as projName,
            etmprojCode as projCode
     from
              tbi_etmproj as etm, tpp_materialMuster as muster
     where
               etm.etmprojId = muster.projid
)

select
                   deptname,
                   projname,
                   projcode
      from     tpp_materialmuster as muster,tempDeptName,tempProjInfo
阅读(1213) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~