Hi, I create a table with ServerID and BagID and insert records like this: INSERT INTO tbServer VALUES (1,1), (2,1), (3,2), (4,3), (5,3), (6,4) Here is the query: SELECT DISTINCT BagID FROM tbServer GROUP BY BagID HAVING COUNT(BagID) = 1; I hope this will help you ...