withの前にセミコロンを投げてみてください:
;with results as
(
select parentouid,net_ouid from net_ou where [email protected]
union all
select t2.parentouid,t2.net_ouid from net_ou t2
inner join results t1 on t1.parentouid = t2.net_ouid where t2.parentouid <> t1.net_ouid
)
この記事 を提供してください あなたがそれをする必要がある理由を理解するために読んでください。スニピット:
個人的に、私はすべてのためにそれをしません CTEですが、それがあなたにとって物事を容易にするなら、それは何も傷つけません。