tristan_wang 发表于 2013-1-13 18:46:05

DB2的with

with temptable(COMCODE,UPPERCOMCODE,Validstatus)as(select root.COMCODE,root.UPPERCOMCODE,root.Validstatus from PRPDCOMPANY root where root.COMCODE=''union all select sub.COMCODE,sub.UPPERCOMCODE,sub.Validstatus from PRPDCOMPANY sub,temptable super where sub.UPPERCOMCODE=super.comcode and sub.comcode<>super.UpperComCode and sub.Validstatus = '1')select COMCODE from temptableORDER BY ComCode
页: [1]
查看完整版本: DB2的with