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

Home -> Community -> Usenet -> c.d.o.server -> Re: Query taking too long - please help

Re: Query taking too long - please help

From: <andrewf_at_jaredgroup.com>
Date: Mon, 08 Feb 1999 17:48:35 GMT
Message-ID: <79n81f$a9b$1@nnrp1.dejanews.com>


The query is really straight forward, the core is to retrieve patient with their most recent visit.

What you need to do is to compute a logical table of most recent visit and join that with patient, something like

Select ...
from patient p,

     (Select acctid, source, Max(updatedate)
      From visit
      group by acctid, source) v

Where p.acctid = v.acctid
and p.source = v.source

I think it will not be difficult for you to come up with what I omit here. You may also need to use hints (as Jonathen suggested) to force Oracle to compute this logical table first.

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Mon Feb 08 1999 - 11:48:35 CST

Original text of this message

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