SELECT *
FROM TABLE a
WHERE EXISTS( SELECT *
FROM TABLE b
WHERE a.ID = b.parentID
AND b.AGE > 20 )
AND EXISTS( SELECT *
FROM TABLE c
WHERE a.ID = c.parentID
AND c.AGE < 20 )
What about if a client has children who are 20?
Paul Morgan
Principal Programmer Analyst
IT Supply Chain/Replenishment
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Dave
Sent: Monday, April 02, 2012 11:56 AM
To: Midrange Systems Technical Discussion
Subject: Sql muddle
Hi,
I'm getting in a real twist with this one :
Given a table with a client and his children with their dates of birth, I
want to select those clients having at least one child aged over 20 AND at
least one child under 20.
This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.