ऐसा लगता है कि आप चाहते हैं:
SELECT ItemRelation, DocumentNum, DocumentYear, IsPromo
FROM [dbo].[promo_data]
WHERE CustomerType = 'XY' AND IsPromo = 1
GROUP BY ItemRelation, DocumentNum, DocumentYear, IsPromo
HAVING COUNT(*) = 1;
संपादित करें:
सभी स्तंभों को पुनः प्राप्त करने के लिए, विंडो फ़ंक्शन का उपयोग करें:
SELECT *
FROM (SELECT pd.*,
COUNT(*) OVER (PARTITION BY ItemRelation, DocumentNum, DocumentYear, IsPromo) as cnt
FROM [dbo].[promo_data] pd
WHERE CustomerType = 'XY' AND IsPromo = 1
) pd
WHERE cnt = 1;