Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQl Query Help

RE: SQl Query Help

From: Christian Antognini <Christian.Antognini_at_trivadis.com>
Date: Fri, 29 Apr 2005 08:26:25 +0200
Message-ID: <7F0C000A3ABA6241A10C9ABF37EEB46D040776@MSXVS01.trivadis.com>


Hi Sanjay

>Now I need the output as
>Fatherid and its ChildId only and only if all of
>it Child are born in some TimeFrame. If any of the
>Child is born out of this TimeFrame then it will=20
>ignore all of those FatherId and ChildId.

To find the fathers a query like the following one should do the trick:

select fatherid
from a, b
where a.childid =3D b.childid
group by a.fatherid
having min(b.dob) >=3D to_date('01-JAN-04') and max(b.dob) <=3D = to_date('31-DEC-04')

HTH
Chris

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Apr 29 2005 - 02:30:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US