Ive been trying to query where a group of row values repeat exactly . like this:
id part_id supplier quantity
1 1 A 20
2 1 B 30
3 2 A 11
4 2 B 30
5 3 A 20
6 3 B 30
we can assume that each part_id will always have both A and B as the suppliers.
My problem is that I want to query for part_id where A=20 and B=30.
The result would be part_id : 1 and 3
How do I do that given that A and B are in 2 different rows? Is this possible?
A sub-select would do:
edit, ok. given the new info, try this for the subselect:
find all the records where the a/b stuff maches, group by the part_id, but only return the part_ids where BOTH a/b parts match. so the case where a=11 will get ignored, because the count would only be 1 in that particular case.