oracle if 多條件判斷 ORACLE查詢樹型關(guān)系是怎樣的?
ORACLE查詢樹型關(guān)系是怎樣的?相關(guān)介紹:在oracle中start with connect by (prior) 用來對樹形結(jié)構(gòu)的數(shù)據(jù)進(jìn)行查詢。其中start with conditon 給出的
ORACLE查詢樹型關(guān)系是怎樣的?
相關(guān)介紹:在oracle中start with connect by (prior) 用來對樹形結(jié)構(gòu)的數(shù)據(jù)進(jìn)行查詢。其中start with conditon 給出的是數(shù)據(jù)搜索范圍, connect by后面給出了遞歸查詢的條件,prior 關(guān)鍵字表示父數(shù)據(jù),prior 條件表示子數(shù)據(jù)需要滿足父數(shù)據(jù)的什么條件。思路:列出所有子,然后判斷所列出的子下面再沒有子了select * from (select ID, parentid from tb start with id="B" connect by prior parentid = idunionselect ID, parentid from tb start with id="G" connect by prior parentid = id ) Awhere not exsits ( select 1 from tb b where A.id= B. parentid)你試試,我沒有環(huán)境。