I have a data set like this.
CREATE TABLE EntityItems (
Id INT NOT NULL,
EnitityItemId INT NOT NULL,
PRIMARY KEY (Id, EnitityItemId)
);
INSERT INTO EntityItems
VALUES
(1, 1),
(1, 2),
(1, 3),
(2, 1),
(2, 2),
(3, 1),
(3, 4)
;
I want to filter this table where any of the group contains both 1 and 2 values(in EntityItemId column) after grouping by Id column.
let's say I am checking for both 1 and 2 values to be there in a group. I am expecting the result as
Id
1
2
Please let me know if you need clarification. Thanks