There are fields for products that contain keys (for groups). You need to select their id from the first entry that you have, without repetitions (if they have the same keys that are not known in advance) For example, there are
id key 1 44 2 44 3 66 4 66 5 77 It should work -> 1,3,5 tried SELECT id FROM table GROUP BY key HAVING COUNT(*) = 1 - did not work