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 -> Correlated subquery (?)

Correlated subquery (?)

From: Dick Willis <rmw_at_synchrony.com>
Date: 15 Apr 1998 01:27:13 GMT
Message-ID: <01bd680d$43406880$3c00a8c0@95server.synchrony.com>


Two tables exist. One has a list of data points and attribute IDs by time.  The attribute changes slowly, so a separate table exists holding the attribute values by attribute ID.

Any attribute will have multiple data points that use the attribute.

I need a query that will return the attribute values for a given range of datapoints.

Select D.Time, A.Attrib1, A.Attrib2, A.Attrib3 from Attributes A, Datapoints D
where (

   D.Attribute_ID = A.Attribute_ID and
   D.Time > Tstart and
   D.Time < Tend

)

will not work well enough because it returns lots of D rows; I only need the first D row for each unique Attribute record in the range of Datapoints from Tstart to Tend.

This seems to be a candidate for correlated subqueries but frankly I am having a difficult time
constructing the appropriate one.

--
Dick Willis, Senior Engineer
Synchrony Industrial Controls, Inc.
rmw_at_synchrony.com
http://www.synchrony.com Received on Tue Apr 14 1998 - 20:27:13 CDT

Original text of this message

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