I am struggling to write a sql query that can retrieve results from a table in a certain way.
I have a table that may have the following type of data. In this table, values in antecendents column are sorted lists of skus in string form
Id | antecendents | ... | ....
1 | ["a","b","c"]| ... | .....
2 | ["a"] | ... | .....
3 | ["a","b"] | ... | .....
4 | ["a","c"] | ... | .....
5 | ["a","c","x"]| ... | .....
6 | ["a","y","c"]| ... | .....
7 | ["c"] | ... | .....
Now suppose I have a set of skus (e.g. "a" and "c")
I want to retrieve only those rows from the table that have all combinations of "a" and "c" but nothing else. So my query would return the following
Id | antecendents | ... | ....
2 | ["a"] | ... | .....
4 | ["a","c"] | ... | .....
7 | ["c"] | ... | .....
I could write a query to get a partial result and further filter it in code but it would be more efficient to have this all be done in a sql query.
Any help would be greatly appreciated.