这个查询在【用xxId和Parent_xxId存储的树】的表中,用的比较多。
每次都记不住,记录一下。
with t as ( select level=1,* from GuPiaoGaiNian where GaiNianID = 'G000542' union all select level+1,a.* from GuPiaoGaiNian a join t b on a.PGaiNianID=b.GaiNianID ) select * from t