sorry in advance for beeing stupid :)
I want to search for different values and then get a group_id back that contains all the values I'm looking for. Is that possible, or does the structure have to be changed for this?
CodePudding user response:
As far as I can tell your existing structure should be OK. You could write a query that goes like this:
SELECT group_id FROM envelope_characteristic WHERE value IN (...);
It'll return all the group_ids that contain the values you're searching for.
CodePudding user response:
For example if you only need to select group_id for which value A, B and C all are available you can use group by with aggregation like below:
SELECT group_id FROM envelope_characteristic
WHERE value IN ('A','B','C');
GROUP BY GROUP_ID
HAVING COUNT(DISTINCT VALUE)=3