Re: What Method do you use to pull data of an orcurrence when 2people see the same person during a certain period
Date: Fri, 10 Dec 1999 23:53:29 GMT
Message-ID: <82s3po$mvu$1_at_nnrp1.deja.com>
Jas,
Did you try the solution I proposed when you first posted this
question? You are absolutely right WHERE doctor = 'A' AND doctor = 'B'
would never work, on the other hand WHERE ( doctor = 'A' OR doctor
= 'B' ) should return all the visits to doctor A AND all the visits to
doctor B. The 2 '0 < ' subqueries assure that you will only list
patients who have visited both doctors in the period chosen. Like I
said before, the solution is not elegant, there may very well be an
easier (faster) way to do this - but it definitely should work. Unless
your table is much larger than I am envisioning, the performace hit
should be tolerable.
Regards,
Paul
In article <3850E365.AEA1BFED_at_msdw.com>,
Jaswinder.Suri_at_msdw.com wrote:
>
> --------------84063FFCDEE9D6B062B0BF3C
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Hello,
> I Require The following output : output 3
>
> D_name Patie Patie Sv_Date
> -------- ----- ----- ---------
> Mr Hussein f4221 f4221 21-AUG-99
> Mr Hussein f4221 f4221 17-SEP-99
> Mr Hussein f4221 f4221 18-SEP-99
> Miss Brown f4221 f4221 24-AUG-99
>
> I could do the following
>
> Select Appointment.D_name,
> Appointment.Patient_no,Patient.Patient_no,
> Appointment.Sv_date
> from Appointment, Patient
> where Appointment.Patient_no = Patient.Patient_no and
> Appointment.D_name ='Mr Hussein' or Appointment.D_name
='Miss
> Brown' and
> Appointment.Sv_date Between to_date('01-AUG-99') and
>
> to_date('30-SEP-99');
>
> I can not use (and) between the two dentist names as this will return
no
> records
> But this pulls in the record of patient M1321
>
> D_name Patie Patie Sv_Date
> ------------- ------ ------ -------------
> Miss Brown f4221 f4221 24-AUG-99
> Miss Brown M1321 M1321 30-SEP-99
> Mr Hussein f4221 f4221 21-AUG-99
> Mr Hussein f4221 f4221 17-SEP-99
> Mr Hussein f4221 f4221 18-SEP-99
>
> Miss Brown M1321 M1321 30-SEP-99 who was seen by Miss Brown only
>
> I can not use (and) between the two dentist names as this will return
no
> records
>
> I have had a few suggestion but i have found they produce a similar
> output.
>
> Any suggestion on what method I need to achieve this result will be
> appreciated.
>
> Thank You very much,
>
> Jas Suri,
>
> --------------84063FFCDEE9D6B062B0BF3C
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML>
> Hello,
> <BR>I Require The following output : output 3
>
<P>D_name &nb
sp;
> Patie Patie Sv_Date
> <BR>--------
> ----- ----- ---------
> <BR>Mr Hussein
f4221
> f4221 21-AUG-99
> <BR>Mr Hussein
f4221
> f4221 17-SEP-99
> <BR>Mr Hussein
f4221
> f4221 18-SEP-99
> <BR>Miss Brown f4221
f4221
> 24-AUG-99
> <P>I could do the following
> <P>Select Appointment.D_name,
Appointment.Patient_no,Patient.Patient_no,
> Appointment.Sv_date
> <BR>from Appointment, Patient
> <BR>where Appointment.Patient_no = Patient.Patient_no and
> <BR>
Appointment.D_name
> ='Mr Hussein' or Appointment.D_name ='Miss Brown' and
> <BR>
Appointment.Sv_date
> Between to_date('01-AUG-99') and
>
<BR> &n bsp; &n bsp; &n bsp; &n bsp; &n bsp;
> to_date('30-SEP-99');
> <P>I can not use (and) between the two dentist names as this will
return
> no records
> <BR>But this pulls in the record of patient M1321
>
<P>D_name &nb sp;
> Patie
Patie
> Sv_Date
> <BR>------------- ------
> ------ -------------
> <BR>Miss Brown
f4221
> f4221 24-AUG-99
> <BR><FONT COLOR="#FF0000">Miss Brown
M1321
> M1321 30-SEP-99</FONT>
> <BR>Mr Hussein
f4221
> f4221 21-AUG-99
> <BR>Mr Hussein
f4221
> f4221 17-SEP-99
> <BR>Mr Hussein
f4221
> f4221 18-SEP-99
> <P>Miss Brown M1321 M1321 30-SEP-99 who
was
> seen by Miss Brown only
> <P>I can not use (and) between the two dentist names as this will
return
> no records
> <P>I have had a few suggestion but i have found they produce a similar
> output.
> <P>Any suggestion on what method I need to achieve this result will be
> appreciated.
> <BR>
> <P>Thank You very much,
> <P>Jas Suri,</HTML>
>
> --------------84063FFCDEE9D6B062B0BF3C--
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sat Dec 11 1999 - 00:53:29 CET