FROM BaseDistricts base-- Try: [6,55] Fail (no rows returned)-- Try: [8,25] Success (at least one row returned)CROSS APPLY ( SELECT d13=d1, d14=d2, dall, [population] FROM dbo.NewDistricts WHERE n = 2 AND d1 = 8 AND d2 = 25 AND d1 NOT IN (base.d1,base.d2,base.d3,d4,d5,d6,d7,d8,d9,d10,d11,d12) AND d2 NOT IN (base.d1,base.d2,base.d3,d4,d5,d6,d7,d8,d9,d10,d11,d12)) a-- Try: [8,66] Fail-- Try: [25,55] Fail-- Try: [36,40] Success!CROSS APPLY ( SELECT d15=d1, d16=d2, dall, [population] FROM dbo.NewDistricts WHERE n = 2 AND d1 = 36 AND d2 = 40 AND d1 NOT IN (base.d1,base.d2,base.d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14) AND d2 NOT IN (base.d1,base.d2,base.d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14)) b