Click to See Complete Forum and Search --> : Formula for Record Calculation


hoyinso
August 30th, 2004, 06:14 AM
I have created two commands in the database expert. And I want to do the calulation of these records.

My situation is:

In table A, I have fields "Country","Amount" and "Currency".
In table B, I have fields "Currency" and "Exchange".

I want get the sum of "Amount"*"Exchange" if table A "Currency" = table B "Currency" that group by "Country"

How to write this formula?

Thank you fro helping me.

harmonycitra
August 30th, 2004, 06:29 PM
Have u linked these commands by currency?

hoyinso
August 30th, 2004, 09:38 PM
Please tell me how to linkand what I should do after linking?
Thanks very much

hoyinso
August 31st, 2004, 06:06 AM
I have linked the currency field of two commands.

My situation is tableB store the currency of all countries in the world. And some of the countries using same currency. If I use a sql statement to join two table, then the records will be duplicated and cannot get the correct exchange rate of each currency.
So that I want to write a formula that caluclate the tableA amount with correct currency. But I don't know how to get the exchange rate of tableB if tableA.currency=tableB.currency.

Do you have any idea to do that?
thanks alot~~~

hoyinso
August 31st, 2004, 06:10 AM
I am using mysql 4.0 which is not supported subquery.

If you have any idea other than my method. Please tell me. This problem spent me a week ago~

Really thanks alot~