首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

db2 递归函数小示范

2012-09-10 
db2 递归函数小示例with rpl(id,name,parent) as (select id,name,parent from A_ORGAN where id999union

db2 递归函数小示例

with rpl(id,name,parent) as (

select id,name,parent from A_ORGAN where id=999

union all

select t1.id,t1.name,t1.parentfrom rpl t2,A_ORGAN t1 where t2.id=t1.parent

)

selectdistinct id,name,parent from rpl order by id asc

?

select t1.id,t1.name from A_ORGANt1 where ?t1.ID=999 or t1.PARENT=999 order by t1.id asc

热点排行