I have tables configured like this:
Parent ------ id, ... Child ----- id, parent_id, x, y
I want to find Parents or a separate parent_id (s) if all the rows in Child containing the given parent_id satisfy the criteria related to x and y (in my case x = y).
For example:
Parent ------ id 1 2 3 Child id, parent_id, x, y 1, 1, 2, 3 2, 1, 3, 4 3, 2, 5, 5 4, 2, 6, 7 5, 3, 8, 8 6, 3, 9, 9
will result in 3. I currently have a query that finds parent_ids that any of the children matches the criteria. Then I use this to get these records and check them in the code if all the children meet the criteria. With the sample data, I get parent_id 2 and 3, get two parent records with all the children, and evaluate. I want to do this with a single request, if possible.
Cheeze5
source share