Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Query taking too long - please help
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
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