Topic: Count Tables

Ho how can count from 3 tables 3 records.

examples:
Table 1
Name
saleryA


Table 2
Name
saleryB


Table 3
Name
saleryC


Sum:= saleryA+saleryB+saleryC

Re: Count Tables

Please describe, where you want show the sum, in TableGrid? or in a textbox?

Dmitry.

Re: Count Tables

Both.
In the text box it should give also the sum of each tablegrid

Re: Count Tables

v_pozidis wrote:

Both.
In the text box it should give also the sum of each tablegrid

An example for you:

Post's attachments

Attachment icon test4.zip 5.06 kb, 476 downloads since 2016-05-30 

Dmitry.

Re: Count Tables

Yes this exactly what I was asking. Thank you.

6 (edited by v_pozidis 2016-06-06 16:26:00)

Re: Count Tables

I face another problem
I send you example.
There you will see 2 tables (MoneyA and MoneyB)  they have a relationship with the Table Customer.
So what I want to do is When I press th TableGrid of The Form1 it should show in the TextBox the
Sum of MoneyA and MoneyB  fr the Customer it is and not for all the customers.
I tried it wit the following script but it has faild

form1.TextBox1.value:= (Select Total(Sallery) from MoneyA where id=Id_Customer)  + Select total(sallery) of MoneyB where id=id_Customer))

*I know that there is a mistake in the script so forgive  me but I don't know SQL. I leran it together with MVDB

Post's attachments

Attachment icon Neo.zip 341.41 kb, 454 downloads since 2016-06-06 

Re: Count Tables

v_pozidis

Form1.Edit1.Value:= SQLExecute('SELECT (SELECT TOTAL(sallery) FROM MoneyA WHERE id_Customer='+Form1.TableGrid1.sqlValue+' ) + (SELECT TOTAL(sallery) FROM MoneyB WHERE id_Customer='+Form1.TableGrid1.sqlValue+')');
Dmitry.

Re: Count Tables

Thank you again for your help and the quick response.