On Sun, Apr 5, 2015 at 11:37 PM, Noel Grandin <[email protected]> wrote:

> Use a nested select. Do the function in the inner select and the where and
> group by in the outer select.
>

​That doesn't help. It calls the function twice. Here's my query:

  SELECT name, dist FROM (
    SELECT name, DISTANCE(name, 'alex') as dist
       FROM Person
    )
    WHERE dist > 0.05
    ORDER BY dist DESC
    LIMIT 5;
​
​This evaluates the `DISTANCE` function twice!

I can confirm that DISTANCE() is being called in the WHERE clause, not in
the ORDER clause (by simply deleting that clause and observing the count).

​thanks for looking,​
-- 
*Harshad RJ <http://lavadip.com>*

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to