[V4RB+Vserve] SUM on 2 tables
Ruslan Zasukhin
sunshine at public.kherson.ua
Tue Nov 16 18:11:55 CST 2004
On 11/16/04 5:05 PM, "Eric Ferrer" <wonderfef at noos.fr> wrote:
>
> Hello all,
>
> I have 3 tables (with fields):
> Customers (ID, Name)
> Invoices (ParentCustomerID, Value)
> Payments (ParentCustomerID, Value)
>
> I'd need to get from a single SQLselect the balance of each customer.
>
> SELECT
> SUM(Invoices.Value) - SUM(Payments.Value),
> Clients.Name
> FROM Invoices, Payments, Customers
> WHERE
> Invoices.ParentCustomerID *= Customers.ID
> OR
> Payments.ParentCustomerID *= Customers.ID
> GROUP BY
> Invoices.ParentCustomerID,
> Payments.ParentCustomerID
> ORDER BY 1 DESC
>
> ... But this is not possible
> Any clue?
Hi Eric,
Valentina 1.x do not support this:
> Invoices.ParentCustomerID *= Customers.ID
> OR
> Payments.ParentCustomerID *= Customers.ID
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina
mailing list