Query I can't crack

  • Thread starter Thread starter Francesca
  • Start date Start date
F

Francesca

Hello, I have a database with a table of Parents and a separate table of
Children, that are related.



Some parents have many children



I want to be able to delete the parents who no longer have any children
under 4. So that when I run the query, it calculates their current ages and
removes the records for parents who have NO under 4s.



If each parent only had 1 child - no problem, but how can I get it to take
into account that the parent may have many children, and therefore may
appear many times in the query that I've set up?



HELP!



Thanks
 
One method, take a look at an EXISTS clause.

SELECT Parents.*
FROM Parents
WHERE NOT Exists (SELECT * FROM Children WHERE Age < 4)
 
I'm sorry but I thought you said you wanted the parent record if they didn't
have at least one kid under four. Was my understanding incorrect?

Can you post the SQL statement you are trying to use and perhaps restate what
you are trying to accomplish?
 
Back
Top