Subject RE: [firebird-support] how to compare a value who comes from sub-select ref/eDN3012773479
Author dennis
Hello Anderson and Alexander



The problem is that this sub-select makes some time delay, if in the where
statement I recall this sub-select the entire query takes the double time on
execution. On hard database dig the query will be delayed by 2.



Does any body knows if this happening on ms-sql and on oracle?



After this discussion I think that the better approach is to make a
procedure for the "rest", to get the result as variable from "select"
statement, where then the variable will be callable from the where statement
:-(.



Take care

Dennis



_____

From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Alexandre Benson
Smith
Sent: Friday, July 27, 2007 7:04 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] how to compare a value who comes from
sub-select ref/eDN3012773479



dennis wrote:
> The problem is that the "rest" of the customer doesn't come from an easy
> outer join but from a procedure that takes some msec to compute it.
>
>
>
> I tried to work the procedure with outer join but was much slower from
> calling it like sub-select.
>
>
>
> Is there any way in where statement to get the value by column like Delphi
> expression: field[2].value ?
>
>
>
> Kind regards
>
> Dennis
>

So, your option is the first query I suggested, this one:

Select
Customer.name customer_name,
(select sum(rest) from movements where movements.customer=customer.code)
entity_rest
from
Customer
Where
Customer.deleted=0 and
(select sum(rest) from movements where movements.customer=customer.code) <>
0

see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br





[Non-text portions of this message have been removed]