递归查询 sqlserver
时间:2021-07-01 10:21:17
帮助过:12人阅读
temp (OID,NAME,PARENT_OID)
AS
(
SELECT D.OID,D.NAME,D.PARENT_OID
FROM T_SYS_DISTRICT D
WHERE D.IS_DELETE
= ‘N‘ AND OID
= ‘2‘
UNION ALL
SELECT S.OID,S.NAME,S.PARENT_OID
FROM T_SYS_DISTRICT S,
temp T
WHERE S.IS_DELETE
= ‘N‘ AND S.PARENT_OID
= T.OID
) SELECT OID,NAME,PARENT_OID
FROM temp;
3.语句解析
不懂
4.结果
递归查询 sqlserver
标签:union mic delete let 递归查询 name sel lazy nio