SELECT d.ItemFROM ( SELECT a.Item, Vendor_Code FROM Purch_Inv_Line a INNER JOIN Purch_Inv_Header a ON a.[Document No_] = b.Item AND b.[Posting Date] BETWEEN '2010-01-01' AND '2010-12-31' GROUP BY a.Item, Vendor_Code ) dGROUP BY d.ItemHAVING COUNT(*) > 1SELECT a.Item, Vendor_Code, vc = DENSE_RANK() OVER(PARTITION BY Item ORDER BY Vendor_Code) FROM Purch_Inv_Line aINNER JOIN Purch_Inv_Header a ON a.[Document No_] = b.Item AND b.[Posting Date] BETWEEN '2010-01-01' AND '2010-12-31'
Far away is close at hand in the images of elsewhere.
Anon.