DECLARE @tb TABLE(a INT,b INT)INSERT INTO @tb SELECT 1,2UNION ALL SELECT 2,3UNION ALL SELECT 2,1UNION ALL SELECT 4,2UNION ALL SELECT 2,4
SELECT COUNT(DISTINCT c)FROM (SELECT a,b,c=a+b FROM @tb) AS t