Subject | Re: [firebird-support] how to compare a value who comes from sub-select ref/eDN3012773479 |
---|---|
Author | Alexandre Benson Smith |
Post date | 2007-07-26T14:36:05Z |
dennis wrote:
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
But I would use that one:
Select
Customer.name customer_name, sum(rest) entity_rest
from
Customer join
movements on (movements.customer=customer.code)
Where
Customer.deleted=0
having
sum(rest) <> 0
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
> I have the follow querySelect
>
>
>
> Select
>
> Customer.name customer_name,
>
> (select sum(rest) from movements where movements.customer=customer.code)
> entity_rest
>
> Where
>
> Customer.deleted=0
>
>
>
> I want to add at where statement the follow comparison
>
> And entity_rest <>0
>
>
>
> But the column is "unknown" (ok, it is really unknown).
>
>
>
> Except to work with outer joins, how may I express this comparison?
>
>
>
> Dennis
>
>
>
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
But I would use that one:
Select
Customer.name customer_name, sum(rest) entity_rest
from
Customer join
movements on (movements.customer=customer.code)
Where
Customer.deleted=0
having
sum(rest) <> 0
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br