On 5/22/06, Brannon King <[EMAIL PROTECTED]> wrote:

> If I understand it right you'll definitely need a correlated subquery.
> You need one query to calculate the max() of the 257(0-256?) values.
> There must be some way to define which values should be used
> in that calculation for a specific piece (the distance). Is
> the distance geometric and calculated from x,y?
>
> In pseudo code something like this:
>
> select piece, ( sub query to calculate max where distance
> from desired_piece < 256 )  from blah  where piece = desired_piece

Explain what you mean by "correlated subquery."

As I understand it you need two categories of information with this query.
"A data point" and "a calculation using all the values within a given
distance". Your query has two "subqueries" since you need two different
pieces of info. Those pieces are related to each other so they're "correlated".
It's database terminology you'll see in books and tutorials.

Here they are on separate lines:
SELECT qi,ri,(drl- (qi - :qi) ) as drl,
MAX(score - ((ri - :ri) * :match)) AS scr
FROM results_1

For your second subquery we need to know which values
are "within a given distance". How is that found?
IE: please define " bounds.upperQi and :ri to bounds.upperRi"

Reply via email to