2012-04-11 35 views

回答

1

在SQL Server(和其他數據庫一樣),你將需要使用一個recursive common table表達,是這樣的:

with some_tree as ( 
    select ... 
    union all 
    select ... 
) 
select * 
from t1 
where t1.id in (select some_id from some_tree); 

自11.2版本的Oracle不還支持遞歸公用表expresions(這樣你就可以使用兩個數據庫的語法相同)