------解决方案-------------------- --> 测试数据:#tb
IF OBJECT_ID('TEMPDB.DBO.#tb') IS NOT NULL DROP TABLE #tb
GO
CREATE TABLE #tb([父节点] VARCHAR(1),[节点] VARCHAR(1))
INSERT #tb
SELECT NULL,'A' UNION ALL
SELECT 'A','B' UNION ALL
SELECT 'A','C' UNION ALL
SELECT 'A','D' UNION ALL
SELECT 'D','E' UNION ALL
SELECT 'D','F' UNION ALL
SELECT 'D','G' UNION ALL
SELECT 'F','A' UNION ALL
SELECT 'F','H'
--------------开始查询--------------------------
SELECT [节点] FROM #tb GROUP BY [节点] HAVING COUNT(*)>1
----------------结果----------------------------
/*
节点
A
*/