我认为应该这样做
SELECT P1.Product_Code,
P2.Product_Code,
Count(DISTINCT S1.SALE_ID)
FROM Product P1
JOIN Product P2
ON P1.Product_Code > P2.Product_Code
LEFT JOIN Sales S1
INNER JOIN Sales S2
ON S1.SALE_ID = S2.SALE_ID
ON S1.Product_Code = P1.Product_Code
AND S2.Product_Code = P2.Product_Code
GROUP BY P1.Product_Code,
P2.Product_Code