--示例
DECLARE
@T TABLE
(ID INT,T VARCHAR(10))
INSERT INTO @T SELECT 1 ,'1-2'
UNION ALL SELECT 2,'2-3'
UNION ALL SELECT 3,'3-4'
UNION ALL SELECT 4,'1-2'
UNION ALL SELECT 5,'4-5'
UNION ALL SELECT 6,'4-5'
UNION ALL SELECT 7,'5-6'
UNION ALL SELECT 8,'7-8'
UNION ALL SELECT 9,'7-8'
SELECT MIN(ID) ID ,T FROM @T GROUP BY T HAVING COUNT(*)=1
UNION
SELECT
MIN(ID) ID,T FROM @T GROUP BY T HAVING COUNT(*)>=2